icy-arctic-fox / spectator

Feature-rich testing framework for Crystal inspired by RSpec.
https://gitlab.com/arctic-fox/spectator
MIT License
103 stars 5 forks source link

Allow matching any line number of example in filter #23

Closed matthewmcgarvey closed 3 years ago

matthewmcgarvey commented 3 years ago

Fixes #19

This allows calling crystal spec file_path:line_number with any number that falls within the specific spec's boundaries.

Caveats

icy-arctic-fox commented 3 years ago
  • You can only specify line numbers that fall within the specific "it" block. You cannot put a line number of the context block and expect all the specs within it to run. From what I've seen, only the it block sources get passed in so there'd have to be a way to hold a reference to it's parent so that it could check if the number falls within its range (and that parent would also have to hold a reference to its parent, etc)

The example's group can be retrieved by calling example.group. The example group has its own source (example.group.source). That could be checked along with parent groups. That might be outside the scope of this PR/issue. Up to you if you want to implement that.

matthewmcgarvey commented 3 years ago

I made a new issue to encompass the line numbers for groupings of specs https://github.com/icy-arctic-fox/spectator/issues/24.

With the one problem of specs with comments/newlines at the end of the block, I think this is ready.