tpope / vim-cucumber

Vim Cucumber runtime files

Home Page:http://www.vim.org/scripts/script.php?script_id=2973

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optional quotes prevent vim-cucumber from finding a step

JESii opened this issue · comments

I have the following steps in my feature file:

    And I swipe "left" a random number of times
    And I swipe "right" a random number of times

and the following step definition:

    Given(/^I swipe "?([^"]*)"? a random number of times$/) do |direction|

With this step definition, ]{Ctrl-D} yields "E388: Couldn't find definition"
However, if I remove the two question marks and just use this:

    Given(/^I swipe "([^"]*)" a random number of times$/) do |direction|

Then vim-cucumber finds the step as expected.
Regardless of which version of the step definition I use, cucumber properly accesses the step.

Feel free to submit an improvement to the Ruby-to-Vim regex translation in s:step_match. Though my recommendation would be you standardize your step syntax rather than complicate your regex.