aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-20 08:44:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-20 08:44:08 +0000
commita10712766c405c4693aa75e7e821f3a727dda8b5 (patch)
tree596f1739e99a3e541905a89f2cbec9d24dd96591 /test/ruby
parent0fbc72f5b4f699164907397fbfdebfd6fcf24130 (diff)
downloadruby-a10712766c405c4693aa75e7e821f3a727dda8b5.tar.gz
enumerator.c: Enumerator::Lazy#uniq
* enumerator.c (lazy_uniq): new method Enumerator::Lazy#uniq. [Feature #11090] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_enumerator.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb
index 3cb9dc789f..bd6b7fa669 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -646,5 +646,10 @@ class TestEnumerator < Test::Unit::TestCase
e.next
assert_raise(StopIteration) { e.peek }
end
+
+ def test_uniq
+ assert_equal([1, 2, 3, 4, 5, 10],
+ (1..Float::INFINITY).lazy.uniq{|x| (x**2) % 10 }.first(6))
+ end
end