mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 22:14:37 +02:00
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
This commit is contained in:
parent
42c6a5137e
commit
6882b35460
3 changed files with 45 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue