Spec: detect nesting it/pending and raise compilation error#7207
Spec: detect nesting it/pending and raise compilation error#7207makenowjust wants to merge 2 commits intocrystal-lang:masterfrom
it/pending and raise compilation error#7207Conversation
Fixed crystal-lang#7192 Fixed specs following changes also
| require "colorize" | ||
|
|
||
| private def colorize(obj, *args) | ||
| private def colorize_wrap(obj, *args) |
There was a problem hiding this comment.
Scope.colorize is resolved inside it block before file-scope colorize method, so it needs to change name.
bcardiff
left a comment
There was a problem hiding this comment.
Nice tricks! but although I like with expr yield a lot, it might need to go a away in the future in favor of modular/incremental compilation. I'm not 100% sure yet, but I would encourage a runtime check.
|
Indeed. And this check pass over nesting def nest_test
it "nest" do
(1 + 1).should eq(2)
end
end
it "test" do
nest_test
endI'll change this to a runtime check. However, finding problem before running is useful in fact... And, there is no way to detect nesting test case inside |
|
Let's use a runtime check. |
|
Specs are typically compiled and executed directly, so there is no big difference between failing at compile time and failing at runtime. It would probably be possible to implement a compile time check with some macro magic, but that makes it so much more complicated + adds unnecessary compilation overhead. |
|
Ok, I decide to rewrite runtime-check this. Thank you @asterite, @straight-shoota, and @bcardiff. |
|
Just a note on the example above: Maybe a single This is just an idea, maybe it's no effort to implement. |
|
@straight-shoota on rspec a pending with block is executed, allowing the developer to code de spec and even check that is not able to run and will fail when the code success (a bit confusing for first timers). I think that a pending that replaces the it is enough and node/comments in the spec should be enough. I wont expect that asserting things in the middle of an in progress spec will be so much used. |
Fixed #7192
Fixed specs following changes also.
NOTE: Reported location looks wrong due to #7147.