Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
ciaranmcnulty opened this Issue · 4 comments

3 participants

@ciaranmcnulty
Collaborator

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
@everzet everzet added the bug label
@everzet
Owner

Good catches @ciaranmcnulty !

@ciaranmcnulty
Collaborator

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

@nchagrass

This also happens on v2.5.0

@everzet
Owner

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

@everzet everzet closed this in dcdba8c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.