cucumber-attic / cucumber-ruby-tcl

Tcl bindings for Cucumber
MIT License
9 stars 6 forks source link

Snippets #12

Open mattwynne opened 9 years ago

mattwynne commented 9 years ago

Luxury feature this, but we should aim for it.

When a step is undefined, Cucumber should delegate to Cucumber-Tcl to get snippet suggestions for Tcl, then print them to the console.

ahhbristow commented 7 years ago

I've got the outline of a custom TCL formatter for this on a branch, which extends the default pretty one, but not sure if this is the correct approach. From looking through Cucumber I can see that it adds support for the "Ruby Language", with the RbLanguage class registering a Ruby snippet generator, so perhaps adding TCL support in a similar way is a better approach, rather than using an entirely different formatter.

mattwynne commented 7 years ago

Yeah @ahhbristow formatters are really for results output, and they delegate to the snippet generators to print the snippets. If you write a snippet generator (it's really just one Ruby proc, or an object that responds to call) then that will allow you to use any of the formatters and still get snippets.

mattwynne commented 7 years ago

So yeah, if you do something like https://github.com/cucumber/cucumber-ruby/blob/master/lib/cucumber/rb_support/rb_language.rb#L56 around about here you'll be on the right track.

mattwynne commented 7 years ago

The existing snippets look more complex than they really are because there's some sophistication around exactly what style of Ruby snippet is generated.

The tests are probably quite instructive though: https://github.com/cucumber/cucumber-ruby/blob/master/spec/cucumber/rb_support/snippet_spec.rb