From 148961adcd0704d964fce920330a6301b9704c25 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 24 Oct 2020 15:52:37 +0200 Subject: Update to ruby/spec@4f59d86 --- spec/ruby/core/warning/element_set_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 spec/ruby/core/warning/element_set_spec.rb (limited to 'spec/ruby/core/warning/element_set_spec.rb') diff --git a/spec/ruby/core/warning/element_set_spec.rb b/spec/ruby/core/warning/element_set_spec.rb new file mode 100644 index 0000000000..ee83656cb4 --- /dev/null +++ b/spec/ruby/core/warning/element_set_spec.rb @@ -0,0 +1,19 @@ +require_relative '../../spec_helper' + +ruby_version_is '2.7' do + describe "Warning.[]=" do + it "emits and suppresses warnings for :deprecated" do + ruby_exe('Warning[:deprecated] = true; $; = ""', args: "2>&1").should =~ /is deprecated/ + ruby_exe('Warning[:deprecated] = false; $; = ""', args: "2>&1").should == "" + end + + it "emits and suppresses warnings for :experimental" do + ruby_exe('Warning[:experimental] = true; eval("0 in a")', args: "2>&1").should =~ /is experimental/ + ruby_exe('Warning[:experimental] = false; eval("0 in a")', args: "2>&1").should == "" + end + + it "raises for unknown category" do + -> { Warning[:noop] = false }.should raise_error(ArgumentError, /unknown category: noop/) + end + end +end -- cgit v1.2.3