ruby-changes:36269
From: nobu <ko1@a...>
Date: Sun, 9 Nov 2014 23:58:49 +0900 (JST)
Subject: [ruby-changes:36269] nobu:r48350 (trunk): test_bmethod.rb: block in bmethod test
nobu 2014-11-09 23:58:33 +0900 (Sun, 09 Nov 2014) New Revision: 48350 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48350 Log: test_bmethod.rb: block in bmethod test * test/-ext-/proc/test_bmethod.rb (test_super_in_bmethod): block in bmethod test for [Feature #10195]. Modified files: trunk/ext/-test-/proc/call_super.c trunk/test/-ext-/proc/test_bmethod.rb Index: ext/-test-/proc/call_super.c =================================================================== --- ext/-test-/proc/call_super.c (revision 48349) +++ ext/-test-/proc/call_super.c (revision 48350) @@ -1,12 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/proc/call_super.c#L1 #include "ruby.h" static VALUE -bug_proc_call_super(VALUE yieldarg, VALUE procarg) +bug_proc_call_super(RB_BLOCK_CALL_FUNC_ARGLIST(yieldarg, procarg)) { VALUE args[2]; + VALUE ret; args[0] = yieldarg; args[1] = procarg; - return rb_call_super(2, args); + ret = rb_call_super(2, args); + if (!NIL_P(blockarg)) { + ret = rb_proc_call(blockarg, ret); + } + return ret; } static VALUE Index: test/-ext-/proc/test_bmethod.rb =================================================================== --- test/-ext-/proc/test_bmethod.rb (revision 48349) +++ test/-ext-/proc/test_bmethod.rb (revision 48350) @@ -21,4 +21,11 @@ class TestProc::TestBMethod https://github.com/ruby/ruby/blob/trunk/test/-ext-/proc/test_bmethod.rb#L21 obj = Bound.new assert_equal([1, 42], obj.foo(1)) end + + def test_block_super + obj = Bound.new + result = nil + obj.foo(2) {|*a| result = a} + assert_equal([2, 42], result) + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/