erikedin / Behavior.jl

Tool for Behavior Driven Development in Julia
Other
25 stars 3 forks source link

Lenient parser: Allow linebreaks between steps #41

Open erikedin opened 3 years ago

erikedin commented 3 years ago

A scenario like this should be allowed optionally, or perhaps unconditionally. Look it up in the reference, if empty lines should be allowed here.

Scenario: Blank lines between steps
   When some action

  Then some postcondition
tk3369 commented 3 years ago

We already know Python behave allows that. I just tried cucumber-js as well and it also works there. So I don't think blank lines matter.

tk3369 commented 3 years ago

Same issue with blank line right after Scenario:

julia> ExecutableSpecifications.Gherkin.parsefeature("""
       Feature: foo
       Scenario: bar

         Given waz
         When woo
         Then cool

       """)
ERROR: MethodError: no method matching getindex(::Nothing, ::Symbol)
Stacktrace:
 [1] parsescenario!(::ExecutableSpecifications.Gherkin.ByLineParser) at /Users/tomkwong/.julia/dev/ExecutableSpecifications/src/Gherkin.jl:443
 [2] parsefeature(::String; options::ExecutableSpecifications.Gherkin.ParseOptions) at /Users/tomkwong/.julia/dev/ExecutableSpecifications/src/Gherkin.jl:488
 [3] parsefeature(::String) at /Users/tomkwong/.julia/dev/ExecutableSpecifications/src/Gherkin.jl:474
 [4] top-level scope at REPL[65]:1