ruby-changes:32122
From: nobu <ko1@a...>
Date: Sat, 14 Dec 2013 13:17:10 +0900 (JST)
Subject: [ruby-changes:32122] nobu:r44201 (trunk): Additional test coverage to Enumerator#peek.
nobu 2013-12-14 13:17:06 +0900 (Sat, 14 Dec 2013) New Revision: 44201 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44201 Log: Additional test coverage to Enumerator#peek. Modified files: trunk/test/ruby/test_enumerator.rb Index: test/ruby/test_enumerator.rb =================================================================== --- test/ruby/test_enumerator.rb (revision 44200) +++ test/ruby/test_enumerator.rb (revision 44201) @@ -616,5 +616,14 @@ class TestEnumerator < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_enumerator.rb#L616 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/