зеркало из https://github.com/github/ruby.git
test_bmethod.rb: block in bmethod test
* test/-ext-/proc/test_bmethod.rb (test_super_in_bmethod): block in bmethod test for [Feature #10195]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
71c8cf27db
Коммит
770128ade3
|
@ -1,12 +1,17 @@
|
|||
#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
|
||||
|
|
|
@ -21,4 +21,11 @@ class TestProc::TestBMethod
|
|||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче