1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix Proc#<< spec

[Bug #16406]
This commit is contained in:
Alan Wu 2019-12-30 18:13:55 -05:00
parent f1ea5d22dc
commit 3264a00958

View file

@ -38,20 +38,34 @@ 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 }
ruby_version_is(''...'2.8') do
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
(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
end
it "is a lambda when self is lambda" do
f = -> x { x * x }
g = proc { |x| x + x }
ruby_version_is('2.8') do
it "is a lambda when parameter is lambda" do
f = -> x { x * x }
g = proc { |x| x + x }
lambda_proc = -> x { x }
(f << g).is_a?(Proc).should == true
(f << g).lambda?.should == true
(f << g).is_a?(Proc).should == true
(f << g).lambda?.should == false
(f << lambda_proc).lambda?.should == true
end
end
it "may accept multiple arguments" do