1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* enumerator.c (lazy_take): don't enumerate an extra value.

[ruby-dev:45370] [Bug #6152]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2012-03-16 02:22:20 +00:00
parent a1f4163dd3
commit 29f73009ca
3 changed files with 25 additions and 5 deletions

View file

@ -201,7 +201,11 @@ class TestLazyEnumerator < Test::Unit::TestCase
assert_equal(5, a.current)
assert_equal(1, a.lazy.take(5).first)
assert_equal(1, a.current)
assert_equal((1..5).to_a, a.lazy.take(5).to_a)
assert_equal((1..5).to_a, a.lazy.take(5).force)
assert_equal(5, a.current)
a = Step.new(1..10)
assert_equal([], a.lazy.take(0).force)
assert_equal(nil, a.current)
end
def test_take_while