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

ruby-changes:61697

From: Nobuyoshi <ko1@a...>
Date: Sat, 13 Jun 2020 22:58:43 +0900 (JST)
Subject: [ruby-changes:61697] 1efc3d6d65 (master): Suppress warnings [Feature #15973]

https://git.ruby-lang.org/ruby.git/commit/?id=1efc3d6d65

From 1efc3d6d65405631630e32bdcc5274bb49f44222 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 13 Jun 2020 22:57:31 +0900
Subject: Suppress warnings [Feature #15973]


diff --git a/spec/ruby/core/kernel/fixtures/classes.rb b/spec/ruby/core/kernel/fixtures/classes.rb
index 623b45c..8702c92 100644
--- a/spec/ruby/core/kernel/fixtures/classes.rb
+++ b/spec/ruby/core/kernel/fixtures/classes.rb
@@ -350,7 +350,7 @@ module KernelSpecs https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/fixtures/classes.rb#L350
 
     module Ampersand
       def lambda(&block)
-        super(&block)
+        suppress_warning {super(&block)}
       end
     end
 
diff --git a/spec/ruby/core/kernel/lambda_spec.rb b/spec/ruby/core/kernel/lambda_spec.rb
index 5c30511..dfe36ce 100644
--- a/spec/ruby/core/kernel/lambda_spec.rb
+++ b/spec/ruby/core/kernel/lambda_spec.rb
@@ -33,7 +33,7 @@ describe "Kernel.lambda" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/lambda_spec.rb#L33
 
   it "returns the passed Proc if given an existing Proc" do
     some_proc = proc {}
-    l = lambda(&some_proc)
+    l = suppress_warning {lambda(&some_proc)}
     l.should equal(some_proc)
     l.lambda?.should be_false
   end
@@ -55,7 +55,7 @@ describe "Kernel.lambda" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/lambda_spec.rb#L55
 
   it "does not create lambda-style Procs when captured with #method" do
     kernel_lambda = method(:lambda)
-    l = kernel_lambda.call { 42 }
+    l = suppress_warning {kernel_lambda.call { 42 }}
     l.lambda?.should be_false
     l.call(:extra).should == 42
   end
diff --git a/spec/ruby/core/proc/fixtures/source_location.rb b/spec/ruby/core/proc/fixtures/source_location.rb
index 688dac1..5572094 100644
--- a/spec/ruby/core/proc/fixtures/source_location.rb
+++ b/spec/ruby/core/proc/fixtures/source_location.rb
@@ -44,7 +44,7 @@ module ProcSpecs https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/proc/fixtures/source_location.rb#L44
 
     def self.my_detached_lambda
       body = -> { true }
-      lambda(&body)
+      suppress_warning {lambda(&body)}
     end
 
     def self.my_detached_proc_new
diff --git a/spec/ruby/core/proc/lambda_spec.rb b/spec/ruby/core/proc/lambda_spec.rb
index fe2ceb4..b2d3f50 100644
--- a/spec/ruby/core/proc/lambda_spec.rb
+++ b/spec/ruby/core/proc/lambda_spec.rb
@@ -15,8 +15,8 @@ describe "Proc#lambda?" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/proc/lambda_spec.rb#L15
   end
 
   it "is preserved when passing a Proc with & to the lambda keyword" do
-    lambda(&->{}).lambda?.should be_true
-    lambda(&proc{}).lambda?.should be_false
+    suppress_warning {lambda(&->{})}.lambda?.should be_true
+    suppress_warning {lambda(&proc{})}.lambda?.should be_false
   end
 
   it "is preserved when passing a Proc with & to the proc keyword" do
-- 
cgit v0.10.2


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

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