mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Additional test coverage to Enumerator#peek.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
14557c7829
commit
7f83b7872a
1 changed files with 9 additions and 0 deletions
|
@ -616,5 +616,14 @@ class TestEnumerator < Test::Unit::TestCase
|
|||
assert_equal 5, 'hello'.each_char.size
|
||||
assert_equal 5, 'hello'.each_codepoint.size
|
||||
end
|
||||
|
||||
def test_peek_for_enumerator_objects
|
||||
e = 2.times
|
||||
assert_equal(0, e.peek)
|
||||
e.next
|
||||
assert_equal(1, e.peek)
|
||||
e.next
|
||||
assert_raise(StopIteration) { e.peek }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue