mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* enumerator.c (enumerator_next_p): should check correctly even when
e.next has not been called before. * enumerator.c (enumerator_next): raise StopIteration (name taken from Python) instead of IndexError. * enum.c (enum_zip): catch StopIteration exception. * enumerator.c (enumerator_with_index): return Enumerator if no block is given. * test/ruby/test_iterator.rb (TestIterator::test_enumerator): add test for enumerators. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cc317d9208
commit
c186fdb90b
5 changed files with 68 additions and 14 deletions
|
@ -798,6 +798,7 @@ RUBY_EXTERN VALUE rb_eFatal;
|
|||
RUBY_EXTERN VALUE rb_eArgError;
|
||||
RUBY_EXTERN VALUE rb_eEOFError;
|
||||
RUBY_EXTERN VALUE rb_eIndexError;
|
||||
RUBY_EXTERN VALUE rb_eStopIteration;
|
||||
RUBY_EXTERN VALUE rb_eKeyError;
|
||||
RUBY_EXTERN VALUE rb_eRangeError;
|
||||
RUBY_EXTERN VALUE rb_eIOError;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue