-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spec: detect nesting it
/pending
and raise compilation error
#7207
Spec: detect nesting it
/pending
and raise compilation error
#7207
Conversation
Fixed crystal-lang#7192 Fixed specs following changes also
@@ -1,7 +1,7 @@ | |||
require "spec" | |||
require "colorize" | |||
|
|||
private def colorize(obj, *args) | |||
private def colorize_wrap(obj, *args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scope.colorize
is resolved inside it
block before file-scope colorize
method, so it needs to change name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
end I'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.