diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-13 15:24:40 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-13 15:24:40 +0000 |
commit | 4007da1792091c8a3fae0380c139f7f3a434c0af (patch) | |
tree | 529439c2a05bb9f5ed49a4f8c8b464a6619514a5 /test | |
parent | 526a853d6d6dbc126aa1e7ab113fc72a481c081c (diff) | |
download | ruby-4007da1792091c8a3fae0380c139f7f3a434c0af.tar.gz |
* enumerator.c (lazy_take_func, lazy_take): multiple calls of
force/to_a method to Enumerator::Lazy#take should return same
results. [ruby-dev:45634] [Bug #6428]
* test/ruby/test_lazy_enumerator.rb (test_take_recycle): add test for
above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_lazy_enumerator.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb index 6920ace34f..a1605a8af0 100644 --- a/test/ruby/test_lazy_enumerator.rb +++ b/test/ruby/test_lazy_enumerator.rb @@ -229,6 +229,14 @@ class TestLazyEnumerator < Test::Unit::TestCase assert_equal(nil, a.current) end + def test_take_recycle + bug6428 = '[ruby-dev:45634]' + a = Step.new(1..10) + take5 = a.lazy.take(5) + assert_equal((1..5).to_a, take5.force, bug6428) + assert_equal((1..5).to_a, take5.force, bug6428) + end + def test_take_while a = Step.new(1..10) assert_equal(1, a.take_while {|i| i < 5}.first) |