зеркало из https://github.com/github/ruby.git
test_refinement.rb: Symbol#to_proc test
* test/ruby/test_refinement.rb (test_symbol_proc): a Symbol is converted to a Proc in the caller's context. [Feature #9451] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
2adba2dc5e
Коммит
9be1910ae0
|
@ -101,6 +101,10 @@ class TestRefinement < Test::Unit::TestCase
|
|||
def self.invoke_call_x_on(foo)
|
||||
return foo.call_x
|
||||
end
|
||||
|
||||
def self.return_proc(&block)
|
||||
block
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1743,6 +1747,7 @@ class TestRefinement < Test::Unit::TestCase
|
|||
|
||||
def test_symbol_proc
|
||||
assert_equal("FooExt#x", FooExtClient.map_x_on(Foo.new))
|
||||
assert_equal("Foo#x", FooExtClient.return_proc(&:x).(Foo.new))
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Загрузка…
Ссылка в новой задаче