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

Already on GitHub? Sign in to your account

Bug: Snippet generation when line ends in argument + colon #448

Closed
ciaranmcnulty opened this Issue Feb 10, 2014 · 4 comments

Comments

Projects
None yet
3 participants
Contributor

ciaranmcnulty commented Feb 10, 2014

Use case

This was uncovered trying to write a snippet that mixes table nodes and arguments, leading to a colon at the end of the line.

  Given the following files in "/tmp":
    |filename |
    |foo.txt  |

Failure case 1 - Arguments suffixed by colon are not replaced

  Given argument "foo":

Expected:

    /**
     * @Given argument :arg1:
     */
    public function argument($arg1)
    {
        throw new PendingException();
    }

Actual:

    /**
     * @Given argument "foo":
     */
    public function argumentFoo()
    {
        throw new PendingException();
    }

The step definition does still match the gherkin step, and the author can amend the pattern manually.

Failure case 2 - Arguments with slash suffixed by colon do not match at all

  Given argument "foo/bar":

Expected:

    /**
     * @Given argument :arg1:
     */
    public function argument($arg1)
    {
        throw new PendingException();
    }

Actual:

    /**
     * @Given argument "foo/bar":
     */
    public function argumentFooBar()
    {
        throw new PendingException();
    }

In this case the step definition will not match the gherkin step, e.g. running a second time will re-trigger snippet generation with a new 'argumentFooBar2' being generated.

@everzet everzet added this to the 3.0.0 milestone Feb 10, 2014

@everzet everzet added the bug label Feb 10, 2014

Owner

everzet commented Feb 10, 2014

Good catches @ciaranmcnulty !

Contributor

ciaranmcnulty commented Feb 10, 2014

I just wish my regex-fu was good enough to fix :-) I will have a look if I can though

This also happens on v2.5.0

Owner

everzet commented Feb 10, 2014

@nchagrass will look into 2.5 too. Thanks for reporting.

everzet added a commit that referenced this issue Feb 11, 2014

@everzet everzet closed this in dcdba8c Feb 11, 2014

everzet added a commit that referenced this issue Feb 11, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment