Skip to content

Commit

Permalink
Update outline tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lsegal committed Mar 26, 2015
1 parent 2811112 commit d2d6131
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions gherkin/i18n.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ type Translation struct {
// Language specific term representing a scenario.
Scenario string

// Language specific term representing a scenario outline.
Outline string

// Language specific term representing the "And" step.
And string

Expand Down Expand Up @@ -42,6 +45,7 @@ var (
Feature: "Feature",
Background: "Background",
Scenario: "Scenario",
Outline: "Scenario Outline",
And: "And",
Given: "Given",
When: "When",
Expand Down
8 changes: 4 additions & 4 deletions gherkin/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ func (p *parser) consumeFeature() error {
}

line, _ := p.lineStripped()
parts := strings.SplitN(line, " ", 2)
parts := strings.SplitN(line, ":", 2)

switch parts[0] {
case p.translations.Background + ":":
case p.translations.Background:
if seenScenario {
return p.err("illegal background after scenario")
} else if seenBackground {
Expand All @@ -184,7 +184,7 @@ func (p *parser) consumeFeature() error {
}
f.Background = b
stags = nil
case p.translations.Scenario + ":":
case p.translations.Scenario, p.translations.Outline:
seenScenario = true

s := Scenario{Filename: p.filename, Line: p.lineNo}
Expand All @@ -198,7 +198,7 @@ func (p *parser) consumeFeature() error {
s.Tags = []Tag{}
}
if len(parts) > 1 {
s.Title = parts[1]
s.Title = strings.TrimSpace(parts[1])
}
f.Scenarios = append(f.Scenarios, s)
stags = nil
Expand Down
2 changes: 1 addition & 1 deletion gherkin/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Feature: Comments at end
func TestScenarioOutlines(t *testing.T) {
s := `
Feature: Scenario outlines
Scenario: Scenario 1
Scenario Outline: Scenario 1
Given some value <foo>
Then some result <bar>
Expand Down

0 comments on commit d2d6131

Please sign in to comment.