arnaucube
arnaucube/mirror-to-giteaPublic Self-hosted repository
mirror-to-gitea/vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes.go
vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes.goRaw
 1package leafnodes
 2
 3import (
 4	"time"
 5
 6	"github.com/onsi/ginkgo/internal/failer"
 7	"github.com/onsi/ginkgo/types"
 8)
 9
10type SetupNode struct {
11	runner *runner
12}
13
14func (node *SetupNode) Run() (outcome types.SpecState, failure types.SpecFailure) {
15	return node.runner.run()
16}
17
18func (node *SetupNode) Type() types.SpecComponentType {
19	return node.runner.nodeType
20}
21
22func (node *SetupNode) CodeLocation() types.CodeLocation {
23	return node.runner.codeLocation
24}
25
26func NewBeforeEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode {
27	return &SetupNode{
28		runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeBeforeEach, componentIndex),
29	}
30}
31
32func NewAfterEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode {
33	return &SetupNode{
34		runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeAfterEach, componentIndex),
35	}
36}
37
38func NewJustBeforeEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode {
39	return &SetupNode{
40		runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeJustBeforeEach, componentIndex),
41	}
42}
43
44func NewJustAfterEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode {
45	return &SetupNode{
46		runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeJustAfterEach, componentIndex),
47	}
48}