diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-23 17:46:33 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-23 17:46:33 +0000 |
commit | fe38109ffe721dda8024214c246fa8af4e6c3d78 (patch) | |
tree | a36739bba4987a7116c1323d43f92024eb2604a8 /test | |
parent | a8e25c92f36cd4c03d0db16fe93f3b8cf205edb3 (diff) | |
download | ruby-fe38109ffe721dda8024214c246fa8af4e6c3d78.tar.gz |
Add test for instance_exec receiving a curried proc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_proc.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 909b42cb8d..b2ce8bcf62 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -261,6 +261,15 @@ class TestProc < Test::Unit::TestCase end, 'moved from btest/knownbug, [ruby-core:15551]') end + def test_curry_instance_exec + a = lambda { |x, y| [x + y, self] } + b = a.curry.call(1) + result = instance_exec 2, &b + + assert_equal(3, result[0]) + assert_equal(self, result[1]) + end + def test_dup_clone b = proc {|x| x + "bar" } class << b; attr_accessor :foo; end |