1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2019-01-27 13:12:39 +00:00
parent a53ee2136f
commit 42921458ff
11 changed files with 127 additions and 15 deletions

View file

@ -440,6 +440,32 @@ describe "C-API Kernel function" do
proc = @s.rb_block_proc() { 1+1 }
proc.should be_kind_of(Proc)
proc.call.should == 2
proc.lambda?.should == false
end
it "passes through an existing lambda and does not convert to a proc" do
b = -> { 1+1 }
proc = @s.rb_block_proc(&b)
proc.should equal(b)
proc.call.should == 2
proc.lambda?.should == true
end
end
describe "rb_block_lambda" do
it "converts the implicit block into a Proc but does not convert it to a lambda" do
proc = @s.rb_block_proc { 1+1 }
proc.should be_kind_of(Proc)
proc.call.should == 2
proc.lambda?.should == false
end
it "passes through an existing Proc and does not convert to a lambda" do
b = proc { 1+1 }
proc = @s.rb_block_proc(&b)
proc.should equal(b)
proc.call.should == 2
proc.lambda?.should == false
end
end