summaryrefslogtreecommitdiff
path: root/spec/ruby/core/warning/element_set_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/warning/element_set_spec.rb')
-rw-r--r--spec/ruby/core/warning/element_set_spec.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/ruby/core/warning/element_set_spec.rb b/spec/ruby/core/warning/element_set_spec.rb
index 80a47ad6a9..ecf75bf85c 100644
--- a/spec/ruby/core/warning/element_set_spec.rb
+++ b/spec/ruby/core/warning/element_set_spec.rb
@@ -7,9 +7,21 @@ ruby_version_is '2.7' do
ruby_exe('Warning[:deprecated] = false; $; = ""', args: "2>&1").should == ""
end
- it "emits and suppresses warnings for :experimental" do
- ruby_exe('Warning[:experimental] = true; eval("1 => a")', args: "2>&1").should =~ /is experimental/
- ruby_exe('Warning[:experimental] = false; eval("1 => a")', args: "2>&1").should == ""
+ describe ":experimental" do
+ before do
+ ruby_version_is ""..."3.0" do
+ @src = 'case 0; in a; end'
+ end
+
+ ruby_version_is "3.0" do
+ @src = '1 => a'
+ end
+ end
+
+ it "emits and suppresses warnings for :experimental" do
+ ruby_exe("Warning[:experimental] = true; eval('#{@src}')", args: "2>&1").should =~ /is experimental/
+ ruby_exe("Warning[:experimental] = false; eval('#{@src}')", args: "2>&1").should == ""
+ end
end
it "raises for unknown category" do