tpope / vim-cucumber

Vim Cucumber runtime files
http://www.vim.org/scripts/script.php?script_id=2973
324 stars 63 forks source link

Optional quotes prevent vim-cucumber from finding a step #28

Closed JESii closed 10 years ago

JESii commented 10 years ago

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.

tpope commented 10 years ago

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.