summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-11-01 13:55:54 +0900
committerKoichi Sasada <ko1@atdot.net>2020-11-01 13:55:54 +0900
commit0e33028d69a25c512df1a44f930652c9a5c5b153 (patch)
tree87d77f4337baacb44eb0a302446c043762a6eb73
parentb1e7c3a31f0a946a6a435acb983126cc6d7693be (diff)
use one-line pattern matching for warning tests
-rw-r--r--spec/ruby/command_line/dash_upper_w_spec.rb2
-rw-r--r--spec/ruby/core/warning/element_set_spec.rb4
-rw-r--r--spec/ruby/language/pattern_matching_spec.rb6
3 files changed, 5 insertions, 7 deletions
diff --git a/spec/ruby/command_line/dash_upper_w_spec.rb b/spec/ruby/command_line/dash_upper_w_spec.rb
index 2b617f9f7f..40e8fba75b 100644
--- a/spec/ruby/command_line/dash_upper_w_spec.rb
+++ b/spec/ruby/command_line/dash_upper_w_spec.rb
@@ -32,7 +32,7 @@ ruby_version_is "2.7" do
describe "The -W command line option with :no-experimental" do
it "suppresses experimental warnings" do
- result = ruby_exe('case 0; in a; end', args: '2>&1')
+ result = ruby_exe('1 => a', args: '2>&1')
result.should =~ /is experimental/
result = ruby_exe('case 0; in a; end', options: '-W:no-experimental', args: '2>&1')
diff --git a/spec/ruby/core/warning/element_set_spec.rb b/spec/ruby/core/warning/element_set_spec.rb
index a6b28282a0..80a47ad6a9 100644
--- a/spec/ruby/core/warning/element_set_spec.rb
+++ b/spec/ruby/core/warning/element_set_spec.rb
@@ -8,8 +8,8 @@ ruby_version_is '2.7' do
end
it "emits and suppresses warnings for :experimental" do
- ruby_exe('Warning[:experimental] = true; eval("case 0; in a; end")', args: "2>&1").should =~ /is experimental/
- ruby_exe('Warning[:experimental] = false; eval("case 0; in a; end")', args: "2>&1").should == ""
+ 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 == ""
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 2d22ec7e64..e653b54840 100644
--- a/spec/ruby/language/pattern_matching_spec.rb
+++ b/spec/ruby/language/pattern_matching_spec.rb
@@ -41,11 +41,9 @@ ruby_version_is "2.7" do
it "warns about pattern matching is experimental feature" do
-> {
eval <<~RUBY
- case 0
- in 0
- end
+ 1 => a
RUBY
- }.should complain(/warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!/)
+ }.should complain(/warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!/)
end
it "binds variables" do