Right now crystal spec file:line
only works if the line number is the same line as the it
, but it'd be nice if any line number inside the do鈥nd
worked, especially with editor integration. Not as important, but related if inside a describe do鈥nd
but not in a spec, ran all specs in that group.
I did a little digging into command and spec, but it seems only the first line is stored for matches?
. Maybe it could be a range, but coming up with the end of the range has me a bit stumped.
Yes, it would be nice. It's not implemented because of what you say: there's currently no way to know when a spec ends. We know the first line with __FILE__
and __LINE__
. We'd need those values for where the block ends. Maybe it
and describe
could be macros, and then we'd need to add macro methods to nodes to get their location at compile time.
I added macro methods to get a node's location, both the beginning and the end. I then tried making describe
and it
be macros, so they can get where the block ends, and it worked. But of course this is only possible with the next compiler, so this feature will have to wait a couple of releases, but it'll be possible :-)
This is actually already working in master 馃帀 . The actual solution involved adding the magic constant __END_LINE__
(similar to __LINE__
)
Most helpful comment
I added macro methods to get a node's location, both the beginning and the end. I then tried making
describe
andit
be macros, so they can get where the block ends, and it worked. But of course this is only possible with the next compiler, so this feature will have to wait a couple of releases, but it'll be possible :-)