func New(failer *failer.Failer) *Suite { topLevelContainer := containernode.New("[Top Level]", types.FlagTypeNone, types.CodeLocation{}) return &Suite{ topLevelContainer: topLevelContainer, currentContainer: topLevelContainer, failer: failer, containerIndex: 1, } }
func (suite *Suite) PushContainerNode(text string, body func(), flag types.FlagType, codeLocation types.CodeLocation) { container := containernode.New(text, flag, codeLocation) suite.currentContainer.PushContainerNode(container) previousContainer := suite.currentContainer suite.currentContainer = container suite.containerIndex++ body() suite.containerIndex-- suite.currentContainer = previousContainer }
} newBef := func(text string, fail bool) leafnodes.BasicNode { return leafnodes.NewBeforeEachNode(newBody(text, fail), codeLocation, 0, failer, 0) } newAft := func(text string, fail bool) leafnodes.BasicNode { return leafnodes.NewAfterEachNode(newBody(text, fail), codeLocation, 0, failer, 0) } newJusBef := func(text string, fail bool) leafnodes.BasicNode { return leafnodes.NewJustBeforeEachNode(newBody(text, fail), codeLocation, 0, failer, 0) } newContainer := func(text string, flag types.FlagType, setupNodes ...leafnodes.BasicNode) *containernode.ContainerNode { c := containernode.New(text, flag, codeLocation) for _, node := range setupNodes { c.PushSetupNode(node) } return c } containers := func(containers ...*containernode.ContainerNode) []*containernode.ContainerNode { return containers } BeforeEach(func() { failer = Failer.New() codeLocation = codelocation.New(0) nodesThatRan = []string{} })