1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-12-27 16:46:08 +01:00
parent 26a9f80c82
commit a2fac1d72c
44 changed files with 772 additions and 514 deletions

View file

@ -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 }