aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-15 05:17:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-15 05:17:07 +0000
commit3b899ea839190dc2053fcbfdb7ec17d7bbaee6b3 (patch)
tree034625bfcb3795105bec0e3c06fd86ae50ffcb83 /test/ruby
parentf948ede8c6eb4c3cb9a9e4252cded72c1b42b76e (diff)
downloadruby-3b899ea839190dc2053fcbfdb7ec17d7bbaee6b3.tar.gz
vm_args.c: allow refinements in Symbol proc
* vm_args.c (refine_sym_proc_call): search and call method with refinements. * vm_args.c (vm_caller_setup_arg_block): enable refinements when enabled in the caller. [Feature #9451] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_symbol.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index d8c91c1eea..a135338edb 100644
--- a/test/ruby/test_symbol.rb
+++ b/test/ruby/test_symbol.rb
@@ -435,4 +435,16 @@ class TestSymbol < Test::Unit::TestCase
assert_equal str, str.to_sym.to_s
assert_not_predicate(str, :frozen?, bug11721)
end
+
+ module WithRefinements
+ using Module.new {refine(Integer) {alias inc succ}}
+ def mapinc(a)
+ a.map(&:inc)
+ end
+ end
+
+ def test_proc_with_refinements
+ obj = Object.new.extend WithRefinements
+ assert_equal [*1..3], obj.mapinc(0..2)
+ end
end