Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(): verify step keyword #192

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Pod/Native/NativeFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ extension NativeFeature {

// Go through each line in turn
var lineNumber = 0
var isPreviousStepKeyword = false
for (lineIndex, line) in lines.enumerated() {
lineNumber += 1

Expand All @@ -92,26 +93,34 @@ extension NativeFeature {
case Language.current.keywords.Background:
featureDescription = featureDescription ?? state.description
state = ParseState(name: lineSuffix, parsingBackground: true)
isPreviousStepKeyword = false
case Language.current.keywords.Scenario,
Language.current.keywords.ScenarioOutline:
featureDescription = featureDescription ?? state.description
saveBackgroundOrScenarioAndUpdateParseState(lineSuffix)
isPreviousStepKeyword = false
case Language.current.keywords.Given,
Language.current.keywords.When,
Language.current.keywords.Then,
Language.current.keywords.And,
Language.current.keywords.But:
isPreviousStepKeyword = true
state.steps.append(.init(keyword: linePrefix, expression: lineSuffix, file: path, line: lineNumber))
case Language.current.keywords.Examples:
state.exampleLines = []
isPreviousStepKeyword = false
case Language.current.keywords.ExampleLine:
state.exampleLines.append((lineIndex+1, lineSuffix))
isPreviousStepKeyword = false
case Language.current.keywords.Feature:
scenarioTags = []
isPreviousStepKeyword = false
default:
isPreviousStepKeyword = false
break
}
} else {
precondition(!isPreviousStepKeyword, "Invalid keyword step")
state.description.append(line)
}
}
Expand Down