summaryrefslogtreecommitdiff
path: root/test/ruby/test_symbol.rb
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-04 04:22:06 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-04 04:22:06 +0000
commit01b20daa86bff5d8c5b4f1b75f6031eb289804c9 (patch)
tree3e417b6111f614f1670a18b915b3286a49d43dbe /test/ruby/test_symbol.rb
parentdb9f1efc4cb93401ce83356903f83caaf26879c6 (diff)
Symbol refinements
* vm_args.c (refine_sym_proc_call): enalbe accidentally disabled refinements in Symbol#to_proc. [Bug #15114] From: osyo (manga osyo) <manga.osyo@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_symbol.rb')
-rw-r--r--test/ruby/test_symbol.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index 36cbf4a710..2f17db520b 100644
--- a/test/ruby/test_symbol.rb
+++ b/test/ruby/test_symbol.rb
@@ -161,6 +161,32 @@ class TestSymbol < Test::Unit::TestCase
assert_equal(1, first, bug11594)
end
+ class TestToPRocArgWithRefinements; end
+ def _test_to_proc_arg_with_refinements_call(&block)
+ block.call TestToPRocArgWithRefinements.new
+ end
+ using Module.new {
+ refine TestToPRocArgWithRefinements do
+ def hoge
+ :hoge
+ end
+ end
+ }
+ def test_to_proc_arg_with_refinements
+ assert_equal(:hoge, _test_to_proc_arg_with_refinements_call(&:hoge))
+ end
+
+ using Module.new {
+ refine TestToPRocArgWithRefinements do
+ def hoge
+ :hogehoge
+ end
+ end
+ }
+ def test_to_proc_arg_with_refinements_override
+ assert_equal(:hogehoge, _test_to_proc_arg_with_refinements_call(&:hoge))
+ end
+
private def return_from_proc
Proc.new { return 1 }.tap(&:call)
end