diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-15 05:17:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-15 05:17:07 +0000 |
commit | 35a29390197750abf97ef16fa0740e377764daef (patch) | |
tree | 034625bfcb3795105bec0e3c06fd86ae50ffcb83 /test | |
parent | 69692d48510d20eda32563914c9b00dff01a1f16 (diff) | |
download | ruby-35a29390197750abf97ef16fa0740e377764daef.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')
-rw-r--r-- | test/ruby/test_symbol.rb | 12 |
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 |