summaryrefslogtreecommitdiff
path: root/test/ruby/test_lazy_enumerator.rb
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-13 15:24:40 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-13 15:24:40 +0000
commit4007da1792091c8a3fae0380c139f7f3a434c0af (patch)
tree529439c2a05bb9f5ed49a4f8c8b464a6619514a5 /test/ruby/test_lazy_enumerator.rb
parent526a853d6d6dbc126aa1e7ab113fc72a481c081c (diff)
* 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/ruby/test_lazy_enumerator.rb')
-rw-r--r--test/ruby/test_lazy_enumerator.rb8
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)