diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2019-12-30 18:13:55 -0500 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2019-12-30 18:13:55 -0500 |
commit | 3264a00958f56e1ba75a95c93e59fc9cccf323e8 (patch) | |
tree | bf8625b386c0f85f71c95fccefdaa465471fd822 /spec/ruby/core/proc | |
parent | f1ea5d22dc94aae4150e9021a9bf47ebfe04f8a9 (diff) | |
download | ruby-3264a00958f56e1ba75a95c93e59fc9cccf323e8.tar.gz |
Fix Proc#<< spec
[Bug #16406]
Diffstat (limited to 'spec/ruby/core/proc')
-rw-r--r-- | spec/ruby/core/proc/compose_spec.rb | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/spec/ruby/core/proc/compose_spec.rb b/spec/ruby/core/proc/compose_spec.rb index cc7d70a182..ef9c125ae9 100644 --- a/spec/ruby/core/proc/compose_spec.rb +++ b/spec/ruby/core/proc/compose_spec.rb @@ -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 } - - (f << g).is_a?(Proc).should == true - (f << g).lambda?.should == false + 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 + 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 |