github.com/CUCUMBER/godog@v0.7.9/gherkin.go (about) 1 package godog 2 3 import "github.com/DATA-DOG/godog/gherkin" 4 5 // examples is a helper func to cast gherkin.Examples 6 // or gherkin.BaseExamples if its empty 7 // @TODO: this should go away with gherkin update 8 func examples(ex interface{}) (*gherkin.Examples, bool) { 9 t, ok := ex.(*gherkin.Examples) 10 return t, ok 11 } 12 13 // means there are no scenarios or they do not have steps 14 func isEmptyFeature(ft *gherkin.Feature) bool { 15 for _, def := range ft.ScenarioDefinitions { 16 if !isEmptyScenario(def) { 17 return false 18 } 19 } 20 return true 21 } 22 23 // means scenario dooes not have steps 24 func isEmptyScenario(def interface{}) bool { 25 switch t := def.(type) { 26 case *gherkin.Scenario: 27 if len(t.Steps) > 0 { 28 return false 29 } 30 case *gherkin.ScenarioOutline: 31 if len(t.Steps) > 0 { 32 return false 33 } 34 } 35 return true 36 }