From f3979aec76868f4bba992d267cbca7a757f4a8b6 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Fri, 14 Apr 2023 11:26:09 +0200 Subject: Add spec for `Warning[:performance]` [Feature #19538] --- NEWS.md | 8 ++++++++ spec/ruby/core/warning/element_reference_spec.rb | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/NEWS.md b/NEWS.md index 834b69c079..d1d60798d0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,6 +7,12 @@ Note that each entry is kept to a minimum, see links for details. ## Language changes +## Command line options + +* A new `performance` warning category was introduced. + They are not displayed by default even in verbose mode. + Turn them on with `-W:performance` or `Warning[:performance] = true`. [[Feature #19538]] + ## Core classes updates Note: We're only listing outstanding class updates. @@ -79,5 +85,7 @@ changelog for details of the default gems or bundled gems. ## JIT [Bug #19150]: https://bugs.ruby-lang.org/issues/19150 +[Feature #18498]: https://bugs.ruby-lang.org/issues/18498 [Feature #19314]: https://bugs.ruby-lang.org/issues/19314 [Feature #19347]: https://bugs.ruby-lang.org/issues/19347 +[Feature #19538]: https://bugs.ruby-lang.org/issues/19538 \ No newline at end of file diff --git a/spec/ruby/core/warning/element_reference_spec.rb b/spec/ruby/core/warning/element_reference_spec.rb index 67728ca0f6..41129e533a 100644 --- a/spec/ruby/core/warning/element_reference_spec.rb +++ b/spec/ruby/core/warning/element_reference_spec.rb @@ -8,6 +8,13 @@ describe "Warning.[]" do end end + ruby_version_is '3.3' do + it "returns default values for :performance category" do + ruby_exe('p Warning[:performance]').chomp.should == "false" + ruby_exe('p Warning[:performance]', options: "-w").chomp.should == "false" + end + end + it "raises for unknown category" do -> { Warning[:noop] }.should raise_error(ArgumentError, /unknown category: noop/) end -- cgit v1.2.3