From 99c7b0b7ea789643bef60085ab59e4b62011ef8b Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Mon, 30 Dec 2019 17:47:58 -0500 Subject: Decide lambdaness of (f << g) using g (#2729) * Deciding lambdaness of (f << g) using g * Use version guards for spec changes --- test/ruby/test_proc.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index c6572ec1ba..1f84b2eb84 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -1413,9 +1413,13 @@ class TestProc < Test::Unit::TestCase def test_compose_with_lambda f = lambda {|x| x * 2} g = lambda {|x| x} + not_lambda = proc {|x| x} assert_predicate((f << g), :lambda?) assert_predicate((g >> f), :lambda?) + assert_predicate((not_lambda << f), :lambda?) + assert_not_predicate((f << not_lambda), :lambda?) + assert_not_predicate((not_lambda >> f), :lambda?) end def test_compose_with_method @@ -1427,6 +1431,7 @@ class TestProc < Test::Unit::TestCase assert_equal(6, (f << g).call(2)) assert_equal(5, (f >> g).call(2)) + assert_predicate((f << g), :lambda?) end def test_compose_with_callable @@ -1438,6 +1443,7 @@ class TestProc < Test::Unit::TestCase assert_equal(6, (f << g).call(2)) assert_equal(5, (f >> g).call(2)) + assert_predicate((f << g), :lambda?) end def test_compose_with_noncallable -- cgit v1.2.3