it_node.go 983 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package leafnodes
  2. import (
  3. "time"
  4. "github.com/onsi/ginkgo/internal/failer"
  5. "github.com/onsi/ginkgo/types"
  6. )
  7. type ItNode struct {
  8. runner *runner
  9. flag types.FlagType
  10. text string
  11. }
  12. func NewItNode(text string, body interface{}, flag types.FlagType, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *ItNode {
  13. return &ItNode{
  14. runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeIt, componentIndex),
  15. flag: flag,
  16. text: text,
  17. }
  18. }
  19. func (node *ItNode) Run() (outcome types.SpecState, failure types.SpecFailure) {
  20. return node.runner.run()
  21. }
  22. func (node *ItNode) Type() types.SpecComponentType {
  23. return types.SpecComponentTypeIt
  24. }
  25. func (node *ItNode) Text() string {
  26. return node.text
  27. }
  28. func (node *ItNode) Flag() types.FlagType {
  29. return node.flag
  30. }
  31. func (node *ItNode) CodeLocation() types.CodeLocation {
  32. return node.runner.codeLocation
  33. }
  34. func (node *ItNode) Samples() int {
  35. return 1
  36. }