github.com/Secbyte/godog@v0.7.14-0.20200116175429-d8f0aeeb70cf/gherkin/dialect.go (about) 1 package gherkin 2 3 type GherkinDialect struct { 4 Language string 5 Name string 6 Native string 7 Keywords map[string][]string 8 } 9 10 func (g *GherkinDialect) FeatureKeywords() []string { 11 return g.Keywords["feature"] 12 } 13 14 func (g *GherkinDialect) ScenarioKeywords() []string { 15 return g.Keywords["scenario"] 16 } 17 18 func (g *GherkinDialect) StepKeywords() []string { 19 result := g.Keywords["given"] 20 result = append(result, g.Keywords["when"]...) 21 result = append(result, g.Keywords["then"]...) 22 result = append(result, g.Keywords["and"]...) 23 result = append(result, g.Keywords["but"]...) 24 return result 25 } 26 27 func (g *GherkinDialect) BackgroundKeywords() []string { 28 return g.Keywords["background"] 29 } 30 31 func (g *GherkinDialect) ScenarioOutlineKeywords() []string { 32 return g.Keywords["scenarioOutline"] 33 } 34 35 func (g *GherkinDialect) ExamplesKeywords() []string { 36 return g.Keywords["examples"] 37 } 38 39 type GherkinDialectProvider interface { 40 GetDialect(language string) *GherkinDialect 41 } 42 43 type gherkinDialectMap map[string]*GherkinDialect 44 45 func (g gherkinDialectMap) GetDialect(language string) *GherkinDialect { 46 return g[language] 47 }