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

Add further examples for valid Cucumber files to pretty-print #2024

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,114 @@ public void commentAtStartAndEndOfFile() {
prettyPrint(gherkinDocument, Syntax.gherkin));
}

@Test
void commentBeforeExamples() {
GherkinDocument gherkinDocument = parse("Feature: Comment before an Examples\n" +
"\n" +
" Scenario Outline: with examples\n" +
" Given the <value> minimalism\n" +
" # then something happens\n" +
"\n" +
" Examples:\n" +
" | value |\n" +
" | 1 |\n" +
" | 2 |\n");
assertEquals("Feature: Comment before an Examples\n" +
"\n" +
" Scenario Outline: with examples\n" +
" Given the <value> minimalism\n" +
" # then something happens\n" +
"\n" +
" Examples:\n" +
" | value |\n" +
" | 1 |\n" +
" | 2 |\n",
prettyPrint(gherkinDocument, Syntax.gherkin));
}

@Test

void commentsBeforeAndAfterKeywords(){
GherkinDocument gherkinDocument = parse("# before Feature\n" +
"Feature: Comments everywhere\n" +
" # after Feature\n" +
"\n" +
" # before Background\n" +
" Background: foo\n" +
" # after Background\n" +
"\n" +
" # before Scenario\n" +
" Scenario: foo\n" +
" # after Scenario\n" +
" # before Given\n" +
" Given nothing\n" +
" # after Given\n" +
"\n" +
" #####\n" +
" # And spaced out\n" +
" ####\n" +
"\n" +
" # before Tag\n" +
" @foo\n" +
" # after Tag\n" +
" Scenario: Foo\n" +
" Given another\n" +
"\n" +
" # before Rule\n" +
" Rule:\n" +
" # after Rule\n" +
"\n" +
" # background comment\n" +
" Background: foo\n" +
"\n" +
" # middling comment\n" +
"\n" +
" # another middling comment\n" +
"\n" +
" # scenario comment\n" +
" Scenario: foo\n");
assertEquals( "# before Feature\n" +
"Feature: Comments everywhere\n" +
" # after Feature\n" +
"\n" +
" # before Background\n" +
" Background: foo\n" +
" # after Background\n" +
"\n" +
" # before Scenario\n" +
" Scenario: foo\n" +
" # after Scenario\n" +
" # before Given\n" +
" Given nothing\n" +
" # after Given\n" +
"\n" +
" #####\n" +
" # And spaced out\n" +
" ####\n" +
"\n" +
" # before Tag\n" +
" @foo\n" +
" # after Tag\n" +
" Scenario: Foo\n" +
" Given another\n" +
"\n" +
" # before Rule\n" +
" Rule:\n" +
" # after Rule\n" +
"\n" +
" # background comment\n" +
" Background: foo\n" +
"\n" +
" # middling comment\n" +
"\n" +
" # another middling comment\n" +
"\n" +
" # scenario comment\n" +
" Scenario: foo\n",
prettyPrint(gherkinDocument, Syntax.gherkin));

}

private GherkinDocument parse(String gherkin) {
GherkinParser parser = GherkinParser
.builder()
Expand Down