blob: 6eded7b763ee3566fd4b6a19ee98b1b74cc25e35 [file] [log] [blame]
Matthias Andreas Benkard832a54e2019-01-29 09:27:38 +01001package leafnodes
2
3import (
4 "time"
5
6 "github.com/onsi/ginkgo/internal/failer"
7 "github.com/onsi/ginkgo/types"
8)
9
10type ItNode struct {
11 runner *runner
12
13 flag types.FlagType
14 text string
15}
16
17func NewItNode(text string, body interface{}, flag types.FlagType, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *ItNode {
18 return &ItNode{
19 runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeIt, componentIndex),
20 flag: flag,
21 text: text,
22 }
23}
24
25func (node *ItNode) Run() (outcome types.SpecState, failure types.SpecFailure) {
26 return node.runner.run()
27}
28
29func (node *ItNode) Type() types.SpecComponentType {
30 return types.SpecComponentTypeIt
31}
32
33func (node *ItNode) Text() string {
34 return node.text
35}
36
37func (node *ItNode) Flag() types.FlagType {
38 return node.flag
39}
40
41func (node *ItNode) CodeLocation() types.CodeLocation {
42 return node.runner.codeLocation
43}
44
45func (node *ItNode) Samples() int {
46 return 1
47}