diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-22 05:51:43 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-22 05:51:43 +0000 |
commit | c71cc2db7f4b179e1a204a0045cea2d80c041874 (patch) | |
tree | 24d0f0bd6510791a7655ce251165e5682a1a025b /test/ruby/test_method.rb | |
parent | 3b7b70650c744f8d045328f782fcad360bdd9f46 (diff) |
Proc#<< and Proc#>>
[Feature #6284]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r-- | test/ruby/test_method.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 5193ac6889..65d9e3d2e1 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -1048,9 +1048,9 @@ class TestMethod < Test::Unit::TestCase } f = c.new.method(:f) g = c.new.method(:g) - h = f * g - assert_equal(6, h.call(2)) + assert_equal(6, (f << g).call(2)) + assert_equal(6, (g >> f).call(2)) end def test_compose_with_proc @@ -1059,9 +1059,9 @@ class TestMethod < Test::Unit::TestCase } f = c.new.method(:f) g = proc {|x| x + 1} - h = f * g - assert_equal(6, h.call(2)) + assert_equal(6, (f << g).call(2)) + assert_equal(6, (g >> f).call(2)) end def test_compose_with_callable @@ -1072,9 +1072,10 @@ class TestMethod < Test::Unit::TestCase def call(x) x + 1 end } f = c.new.method(:f) - g = f * c2.new + g = c2.new - assert_equal(6, g.call(2)) + assert_equal(6, (f << g).call(2)) + assert_equal(5, (f >> g).call(2)) end def test_compose_with_noncallable @@ -1082,10 +1083,12 @@ class TestMethod < Test::Unit::TestCase def f(x) x * 2 end } f = c.new.method(:f) - g = f * 5 assert_raise(NoMethodError) { - g.call(2) + (f << 5).call(2) + } + assert_raise(NoMethodError) { + (f >> 5).call(2) } end end |