summaryrefslogtreecommitdiff
path: root/test/ruby/test_refinement.rb
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-02 05:48:29 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-02 05:48:29 +0000
commitbb504213816e4598f1961b99e115f8ba59bef71f (patch)
treeff451d7ff4f58697fb5aff4779c4d8d9740481ad /test/ruby/test_refinement.rb
parent499b5a9197f68e14873e641b737aea40a0f8bc5a (diff)
* string.c (sym_to_proc, sym_call): A Proc created by Symbol#to_proc
should close over the current refinements. [ruby-dev:46345] [Bug #7261] * vm_eval.c (rb_call0, rb_search_method_entry, rb_funcall_passing_block_with_refinements): add a new argument `refinements' for the above changes. * test/ruby/test_refinement.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_refinement.rb')
-rw-r--r--test/ruby/test_refinement.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index cecb5a0665..4a0e6d1327 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -600,4 +600,26 @@ class TestRefinement < Test::Unit::TestCase
assert_equal(:m1, m.module_eval { c.new.m1 })
assert_equal(:m2, m.module_eval { c.new.m2 })
end
+
+ module SymbolToProc
+ class C
+ end
+
+ module M
+ refine C do
+ def foo
+ "foo"
+ end
+ end
+
+ def self.call_foo
+ c = C.new
+ :foo.to_proc.call(c)
+ end
+ end
+ end
+
+ def test_symbol_to_proc
+ assert_equal("foo", SymbolToProc::M.call_foo)
+ end
end