-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
add spec for Warning[category] = true|false to emit/suppress warnings #806
add spec for Warning[category] = true|false to emit/suppress warnings #806
Conversation
I think it's because |
6cd1314
to
5ecf14f
Compare
@eregon Once again, thank you for your precious feedback. 🙇 Today I Learned...
(and I guess, that's why it works in You are right, the warnings disappear with Given this Warning[:experimental] = false
0 in a ruby ./script.rb
# ./script.rb:2: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby! I'd expect that (Sorry for my annoying questions 😉) |
Feel free to mention that drawback on the issue, but it is expected behavior, parse-time warnings can only be disabled if it's set before parsing of course. And pattern matching emits a parse-time warning. |
cdfe9d4
to
cf17c35
Compare
@eregon 👍 Alright, in that case I think that part of the feature is kind of pointless, even if's technically explainable... 🤷 😀 Thanks for your explanation. I changed the specs accordingly and marked this PR as "Ready for review": |
ruby_version_is '2.7' do | ||
describe "Warning.[]" do | ||
it "returns default values for categories :deprecated and :experimental" do | ||
Warning[:deprecated].should == true |
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.
Actually deprecated
defaults to false
in 2.7.2
(but it is true
in 2.7.0&1).
I'd suggest using ruby_version_is
guards to test that one since it's the big change in 2.7.2:
https://www.ruby-lang.org/en/news/2020/10/02/ruby-2-7-2-released/
Also I just updated the CI to use 2.7.2 so this would actually fail the CI when rebased.
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.
Looks great!
cf17c35
to
f10289f
Compare
f10289f
to
e38230c
Compare
@eregon I rebased However, I had to change the spec n to use
I have no idea why this is 😏 ... do you? |
It's because of ruby/mspec@e154fa1, which is intended but I did not think about it in this context. |
Thanks for that, I was very confused... 😂 |
Hello 👋
This time I'll try to cover this one from #745
However, I discovered that suppressing experimental (
Warning[:experimental] = false
) does not seem to work when invoking a script withruby -e '...'
. Inirb
it works as expected.Example:
Is this expected, or am I missing something here?