diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-14 10:29:25 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-14 10:29:25 +0000 |
commit | 0b35e9e5ddb329dac027d72851db015a738852d7 (patch) | |
tree | 001a9eb630f1b96357a951357e9b3b2607149a58 /test/ruby/test_lazy_enumerator.rb | |
parent | 0d94434eca76abeb13dda88d2695777bbca7f31a (diff) | |
download | ruby-0b35e9e5ddb329dac027d72851db015a738852d7.tar.gz |
* enumerator.c (lazy_take): add Enumerable::Lazy#take.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_lazy_enumerator.rb')
-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 9e50cd3a69..3adaaa32f3 100644 --- a/test/ruby/test_lazy_enumerator.rb +++ b/test/ruby/test_lazy_enumerator.rb @@ -143,4 +143,12 @@ class TestLazyEnumerator < Test::Unit::TestCase assert_equal(["a", 1], a.lazy.zip("a".."c") {|x, y| [y, x]}.first) assert_equal(1, a.current) end + + def test_take + a = Step.new(1..3) + assert_equal(1, a.take(2).first) + assert_equal(2, a.current) + assert_equal(1, a.lazy.take(2).first) + assert_equal(1, a.current) + end end |