mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Suppress warnings [Feature #15973]
This commit is contained in:
parent
1f1b62fb7b
commit
1efc3d6d65
4 changed files with 6 additions and 6 deletions
|
@ -350,7 +350,7 @@ module KernelSpecs
|
|||
|
||||
module Ampersand
|
||||
def lambda(&block)
|
||||
super(&block)
|
||||
suppress_warning {super(&block)}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ describe "Kernel.lambda" do
|
|||
|
||||
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
|
|||
|
||||
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
|
||||
|
|
|
@ -44,7 +44,7 @@ module ProcSpecs
|
|||
|
||||
def self.my_detached_lambda
|
||||
body = -> { true }
|
||||
lambda(&body)
|
||||
suppress_warning {lambda(&body)}
|
||||
end
|
||||
|
||||
def self.my_detached_proc_new
|
||||
|
|
|
@ -15,8 +15,8 @@ describe "Proc#lambda?" do
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue