Bug #12531 » fix_curry_with_block.patch
proc.c | ||
---|---|---|
return arity;
|
||
}
|
||
else {
|
||
return rb_proc_call_with_block(proc, check_argc(RARRAY_LEN(passed)), RARRAY_CONST_PTR(passed), passed_proc);
|
||
VALUE corrected_passed_proc = (SYMBOL_P(passed_proc)) ? sym_proc_new(rb_cProc, passed_proc) : passed_proc;
|
||
return rb_proc_call_with_block(proc, check_argc(RARRAY_LEN(passed)), RARRAY_CONST_PTR(passed), corrected_passed_proc);
|
||
}
|
||
}
|
||
test/ruby/test_proc.rb | ||
---|---|---|
assert_equal(9, b)
|
||
end
|
||
def test_curry_with_block
|
||
b = proc { true }.curry
|
||
assert(b.call, "without block")
|
||
assert(b.call { |o| o.to_s }, "with block")
|
||
assert(b.call(&:to_s), "with sym block")
|
||
b = lambda { true }.curry
|
||
assert(b.call, "without block")
|
||
assert(b.call { |o| o.to_s }, "with block")
|
||
assert(b.call(&:to_s), "with sym block")
|
||
end
|
||
def test_lambda?
|
||
l = proc {}
|
||
assert_equal(false, l.lambda?)
|
- « Previous
- 1
- 2
- Next »