Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Pretty formatter cannot handle comments in feature correctly #347

Open
xuanzhaopeng opened this issue Apr 1, 2016 · 0 comments
Open

Pretty formatter cannot handle comments in feature correctly #347

xuanzhaopeng opened this issue Apr 1, 2016 · 0 comments

Comments

@xuanzhaopeng
Copy link

Description:

When there are several comments in feature file, which contains one scenario outline, the pretty formatter cannot handle it correctly.

Stack Trace:

java.lang.StringIndexOutOfBoundsException: String index out of range: -2
    at java.lang.String.substring(String.java:1954)
    at gherkin.formatter.StepPrinter.writeStep(StepPrinter.java:11)
    at gherkin.formatter.PrettyFormatter.printStep(PrettyFormatter.java:259)
    at gherkin.formatter.PrettyFormatter.printSteps(PrettyFormatter.java:130)
    at gherkin.formatter.PrettyFormatter.replay(PrettyFormatter.java:121)
    at gherkin.formatter.PrettyFormatter.scenario(PrettyFormatter.java:98)

How to reproduce :

Feature : My feature

comments 1

comments 2

Scenario Outline : My scenaroi called
Given I do sth1
# comment
When I do sth2
# comment
Then I do sth3

Examples:
# comment here
| Arg1 | Name |
# comment here
# comment here
| Val1 | Val2 |
# comment here

Guess :

I follow the step from Cucumber-jvm to gherkin2, I found the problems seems could be located in PrettyFormatter.replay() , maybe in more detail, it is located in PrettyFormatter.addAnyOrphanMatch()

If I get deep debug information, I will let u all know

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant