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

ruby-changes:64117

From: Yusuke <ko1@a...>
Date: Sat, 12 Dec 2020 23:27:09 +0900 (JST)
Subject: [ruby-changes:64117] 7ef5226520 (master): spec: suppress deprecations of "lambda(&proc_block)" pattern

https://git.ruby-lang.org/ruby.git/commit/?id=7ef5226520

From 7ef5226520cbd13bdbc65a7f3c60188e002b133c Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Sat, 12 Dec 2020 23:25:15 +0900
Subject: spec: suppress deprecations of "lambda(&proc_block)" pattern


diff --git a/spec/ruby/core/kernel/lambda_spec.rb b/spec/ruby/core/kernel/lambda_spec.rb
index dfe36ce..4dd34c6 100644
--- a/spec/ruby/core/kernel/lambda_spec.rb
+++ b/spec/ruby/core/kernel/lambda_spec.rb
@@ -27,8 +27,10 @@ describe "Kernel.lambda" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/lambda_spec.rb#L27
   end
 
   it "creates a lambda-style Proc if given a literal block via Kernel.public_send" do
-    l = Kernel.public_send(:lambda) { 42 }
-    l.lambda?.should be_true
+    suppress_warning do
+      l = Kernel.public_send(:lambda) { 42 }
+      l.lambda?.should be_true
+    end
   end
 
   it "returns the passed Proc if given an existing Proc" do
@@ -39,11 +41,13 @@ describe "Kernel.lambda" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/lambda_spec.rb#L41
   end
 
   it "creates a lambda-style Proc when called with zsuper" do
-    l = KernelSpecs::LambdaSpecs::ForwardBlockWithZSuper.new.lambda { 42 }
-    l.lambda?.should be_true
-    l.call.should == 42
+    suppress_warning do
+      l = KernelSpecs::LambdaSpecs::ForwardBlockWithZSuper.new.lambda { 42 }
+      l.lambda?.should be_true
+      l.call.should == 42
 
-    lambda { l.call(:extra) }.should raise_error(ArgumentError)
+      lambda { l.call(:extra) }.should raise_error(ArgumentError)
+    end
   end
 
   it "returns the passed Proc if given an existing Proc through super" do
diff --git a/spec/ruby/core/kernel/shared/lambda.rb b/spec/ruby/core/kernel/shared/lambda.rb
index c7180e1..c706400 100644
--- a/spec/ruby/core/kernel/shared/lambda.rb
+++ b/spec/ruby/core/kernel/shared/lambda.rb
@@ -4,6 +4,8 @@ describe :kernel_lambda, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/shared/lambda.rb#L4
   end
 
   it "raises an ArgumentError when no block is given" do
-    -> { send(@method) }.should raise_error(ArgumentError)
+    suppress_warning do
+      -> { send(@method) }.should raise_error(ArgumentError)
+    end
   end
 end
diff --git a/spec/ruby/language/lambda_spec.rb b/spec/ruby/language/lambda_spec.rb
index 1c9acba..630817c 100644
--- a/spec/ruby/language/lambda_spec.rb
+++ b/spec/ruby/language/lambda_spec.rb
@@ -348,7 +348,9 @@ describe "A lambda expression 'lambda { ... }'" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/lambda_spec.rb#L348
   end
 
   it "requires a block" do
-    lambda { lambda }.should raise_error(ArgumentError)
+    suppress_warning do
+      lambda { lambda }.should raise_error(ArgumentError)
+    end
   end
 
   it "may include a rescue clause" do
@@ -375,9 +377,11 @@ describe "A lambda expression 'lambda { ... }'" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/lambda_spec.rb#L377
     ruby_version_is "2.7" do
       it "raises ArgumentError" do
         implicit_lambda = nil
-        -> {
-          meth { 1 }
-        }.should raise_error(ArgumentError, /tried to create Proc object without a block/)
+        suppress_warning do
+          -> {
+            meth { 1 }
+          }.should raise_error(ArgumentError, /tried to create Proc object without a block/)
+        end
       end
     end
   end
-- 
cgit v0.10.2


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

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