diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-12-27 16:46:08 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-12-27 16:46:08 +0100 |
commit | a2fac1d72c225192018f8f3f3dfcfcc46f66c08a (patch) | |
tree | dc2d44079962ce242d971a4d1c2a2b1333e64cec /spec/ruby/core/proc | |
parent | 26a9f80c823a9f536a235d80d600aa9e03ed7a2f (diff) |
Update to ruby/spec@d419e74
Diffstat (limited to 'spec/ruby/core/proc')
-rw-r--r-- | spec/ruby/core/proc/compose_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/ruby/core/proc/compose_spec.rb b/spec/ruby/core/proc/compose_spec.rb index 35e949a779..cc7d70a182 100644 --- a/spec/ruby/core/proc/compose_spec.rb +++ b/spec/ruby/core/proc/compose_spec.rb @@ -38,6 +38,22 @@ ruby_version_is "2.6" do (f << g).lambda?.should == false end + it "is a Proc when other is lambda" do + f = proc { |x| x * x } + g = -> x { x + x } + + (f << g).is_a?(Proc).should == true + (f << g).lambda?.should == false + end + + it "is a lambda when self is lambda" do + f = -> x { x * x } + g = proc { |x| x + x } + + (f << g).is_a?(Proc).should == true + (f << g).lambda?.should == true + end + it "may accept multiple arguments" do inc = proc { |n| n + 1 } mul = proc { |n, m| n * m } @@ -91,6 +107,22 @@ ruby_version_is "2.6" do (f >> g).lambda?.should == false end + it "is a Proc when other is lambda" do + f = proc { |x| x * x } + g = -> x { x + x } + + (f >> g).is_a?(Proc).should == true + (f >> g).lambda?.should == false + end + + it "is a lambda when self is lambda" do + f = -> x { x * x } + g = proc { |x| x + x } + + (f >> g).is_a?(Proc).should == true + (f >> g).lambda?.should == true + end + it "may accept multiple arguments" do inc = proc { |n| n + 1 } mul = proc { |n, m| n * m } |