Skip to content

Commit

Permalink
Fix #349
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Läubrich committed Apr 10, 2019
1 parent ee55287 commit c7cd01c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,14 @@ public void scenarioOutline(ScenarioOutline scenarioOutline) {
@Override
public void examples(Examples examples) {
ExamplesTableRow examplesHeader = examples.getRows().get(0);
int variablesSize = examplesHeader.getCells().size();
for (int i = 1; i < examples.getRows().size(); i++) {
ExamplesTableRow currentExample = examples.getRows().get(i);
int examplesSize = currentExample.getCells().size();
if (examplesSize != variablesSize) {
markerFactory.syntaxErrorOnGherkin(gherkinFile, "The number of examples ("+examplesSize+")does not match the number of variables ("+variablesSize+")", currentExample.getLine());
continue;
}
try {
matchScenarioOutlineExample(examplesHeader, currentExample);
} catch (CoreException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,19 @@ public void syntaxErrorOnGherkin(IResource stepDefinitionResource, Exception e)

public void syntaxErrorOnGherkin(final IResource gherkinResource, final Exception e, final int lineNumber) {

syntaxErrorOnGherkin(gherkinResource, e.getMessage(), lineNumber);

}

public void syntaxErrorOnGherkin(final IResource gherkinResource, String msg, final int lineNumber) {

this.mark(gherkinResource, new IMarkerBuilder() {
@Override
public IMarker build() throws CoreException {
IMarker marker = null;
marker = gherkinResource.createMarker(GHERKIN_SYNTAX_ERROR);
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
marker.setAttribute(IMarker.MESSAGE, e.getMessage());
marker.setAttribute(IMarker.MESSAGE, msg);
marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
return marker;
}
Expand Down

0 comments on commit c7cd01c

Please sign in to comment.