mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
range.c: revert the old behavior
* range.c (range_each): revert the old behavior, no block is given to the yielded block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
07c15e8b10
commit
4ce307aeee
2 changed files with 9 additions and 1 deletions
2
range.c
2
range.c
|
@ -796,7 +796,7 @@ range_each(VALUE range)
|
|||
|
||||
args[0] = end;
|
||||
args[1] = EXCL(range) ? Qtrue : Qfalse;
|
||||
rb_block_call(tmp, rb_intern("upto"), 2, args, rb_yield_block, 0);
|
||||
rb_block_call(tmp, rb_intern("upto"), 2, args, each_i, 0);
|
||||
}
|
||||
else {
|
||||
if (!discrete_object_p(beg)) {
|
||||
|
|
|
@ -558,4 +558,12 @@ class TestRange < Test::Unit::TestCase
|
|||
assert_equal(42, answer, msg)
|
||||
}
|
||||
end
|
||||
|
||||
def test_each_no_blockarg
|
||||
a = "a"
|
||||
def a.upto(x, e, &b)
|
||||
super {|y| b.call(y) {|z| assert(false)}}
|
||||
end
|
||||
(a.."c").each {|x, &b| assert_nil(b)}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue