зеркало из https://github.com/github/ruby.git
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
This commit is contained in:
Родитель
a8e25c92f3
Коммит
fe38109ffe
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче