Matthias Andreas Benkard | 832a54e | 2019-01-29 09:27:38 +0100 | [diff] [blame] | 1 | package leafnodes |
| 2 | |
| 3 | import ( |
| 4 | "time" |
| 5 | |
| 6 | "github.com/onsi/ginkgo/internal/failer" |
| 7 | "github.com/onsi/ginkgo/types" |
| 8 | ) |
| 9 | |
| 10 | type ItNode struct { |
| 11 | runner *runner |
| 12 | |
| 13 | flag types.FlagType |
| 14 | text string |
| 15 | } |
| 16 | |
| 17 | func 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 | |
| 25 | func (node *ItNode) Run() (outcome types.SpecState, failure types.SpecFailure) { |
| 26 | return node.runner.run() |
| 27 | } |
| 28 | |
| 29 | func (node *ItNode) Type() types.SpecComponentType { |
| 30 | return types.SpecComponentTypeIt |
| 31 | } |
| 32 | |
| 33 | func (node *ItNode) Text() string { |
| 34 | return node.text |
| 35 | } |
| 36 | |
| 37 | func (node *ItNode) Flag() types.FlagType { |
| 38 | return node.flag |
| 39 | } |
| 40 | |
| 41 | func (node *ItNode) CodeLocation() types.CodeLocation { |
| 42 | return node.runner.codeLocation |
| 43 | } |
| 44 | |
| 45 | func (node *ItNode) Samples() int { |
| 46 | return 1 |
| 47 | } |