summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKazuki Tsujimoto <kazuki@callcc.net>2020-11-01 17:24:36 +0900
committerKazuki Tsujimoto <kazuki@callcc.net>2020-11-01 17:37:03 +0900
commite0e2492cd30eb76f084f189060de9a79d619f16e (patch)
tree3113d307ef41e188d9b64178e1b9dba5f2c67984 /spec
parente03e1982bdc2d815298b211d44534908d79aec4e (diff)
Fix Rubyspec (ruby-2.7) failures
https://github.com/ruby/ruby/runs/1337845174
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/command_line/dash_upper_w_spec.rb14
-rw-r--r--spec/ruby/core/warning/element_set_spec.rb18
-rw-r--r--spec/ruby/language/pattern_matching_spec.rb20
3 files changed, 41 insertions, 11 deletions
diff --git a/spec/ruby/command_line/dash_upper_w_spec.rb b/spec/ruby/command_line/dash_upper_w_spec.rb
index 40e8fba75b..62c617b892 100644
--- a/spec/ruby/command_line/dash_upper_w_spec.rb
+++ b/spec/ruby/command_line/dash_upper_w_spec.rb
@@ -31,11 +31,21 @@ ruby_version_is "2.7" do
end
describe "The -W command line option with :no-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 "suppresses experimental warnings" do
- result = ruby_exe('1 => a', args: '2>&1')
+ result = ruby_exe(@src, args: '2>&1')
result.should =~ /is experimental/
- result = ruby_exe('case 0; in a; end', options: '-W:no-experimental', args: '2>&1')
+ result = ruby_exe(@src, options: '-W:no-experimental', args: '2>&1')
result.should == ""
end
end
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
diff --git a/spec/ruby/language/pattern_matching_spec.rb b/spec/ruby/language/pattern_matching_spec.rb
index e653b54840..6eefcf5ab6 100644
--- a/spec/ruby/language/pattern_matching_spec.rb
+++ b/spec/ruby/language/pattern_matching_spec.rb
@@ -38,12 +38,20 @@ ruby_version_is "2.7" do
RUBY
end
- it "warns about pattern matching is experimental feature" do
- -> {
- eval <<~RUBY
- 1 => a
- RUBY
- }.should complain(/warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!/)
+ describe "warning" 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 "warns about pattern matching is experimental feature" do
+ -> { eval @src }.should complain(/pattern matching is experimental, and the behavior may change in future versions of Ruby!/i)
+ end
end
it "binds variables" do