diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-27 13:12:39 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-27 13:12:39 +0000 |
commit | 42921458ff7eacd1ef614c3e67596c75ccd0a1d4 (patch) | |
tree | 710c40988e51715f84a12c3295162b1c5697bf51 /spec/ruby/optional/capi/kernel_spec.rb | |
parent | a53ee2136ff59ebc54ae6c98a500765bc3d13d44 (diff) | |
download | ruby-42921458ff7eacd1ef614c3e67596c75ccd0a1d4.tar.gz |
Update to ruby/spec@e57f49c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/optional/capi/kernel_spec.rb')
-rw-r--r-- | spec/ruby/optional/capi/kernel_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/ruby/optional/capi/kernel_spec.rb b/spec/ruby/optional/capi/kernel_spec.rb index e50ae9c4e4..627442104f 100644 --- a/spec/ruby/optional/capi/kernel_spec.rb +++ b/spec/ruby/optional/capi/kernel_spec.rb @@ -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 |