[前][次][番号順一覧][スレッド一覧]

ruby-changes:63494

From: Koichi <ko1@a...>
Date: Sun, 1 Nov 2020 13:56:23 +0900 (JST)
Subject: [ruby-changes:63494] 0e33028d69 (master): use one-line pattern matching for warning tests

https://git.ruby-lang.org/ruby.git/commit/?id=0e33028d69

From 0e33028d69a25c512df1a44f930652c9a5c5b153 Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Sun, 1 Nov 2020 13:55:54 +0900
Subject: use one-line pattern matching for warning tests


diff --git a/spec/ruby/command_line/dash_upper_w_spec.rb b/spec/ruby/command_line/dash_upper_w_spec.rb
index 2b617f9..40e8fba 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/command_line/dash_upper_w_spec.rb#L32
 
   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 a6b2828..80a47ad 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/warning/element_set_spec.rb#L8
     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 2d22ec7..e653b54 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L41
     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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]