aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_enumerator.rb
Commit message (Collapse)AuthorAgeFilesLines
* enum.c: check argument firstnobu2017-11-051-0/+2
| | | | | | | * enum.c (enum_cycle_size): check an argument before the size of the receiver, if it is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix size on Enumerable#cycle when the size is 0 [Bug #14082].marcandre2017-11-051-0/+7
| | | | | | Patch by Kenichi Kamiya git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c: Enumerator::Lazy#uniqnobu2016-07-201-0/+5
| | | | | | | * 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
* test/ruby: suppress parser warningsnobu2016-02-191-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Kernel#loop returns the result value of a finished iteratorknu2015-10-221-0/+8
| | | | | | | | * vm_eval.c (rb_f_loop): When a loop is stopped by a StopIteration exception, return what the enumerator has returned instead of nil. [ruby-core:71133] [Feature #11498] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* preserve encodings in error messagesnobu2015-09-281-0/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/lib/envutil.rb: Moved from test/ruby/.akr2014-11-131-1/+0
| | | | | | | | | | | | | | * test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merge GH-558nobu2014-03-101-1/+1
| | | | | | | * test/ruby/test_enumerator.rb (test_iterators): fix test for hash iterators. [Fixes GH-558] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Additional test coverage to Enumerator#peek.nobu2013-12-141-0/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: rb_hash_reject without dupnobu2013-12-071-3/+7
| | | | | | | | * hash.c (rb_hash_reject): copy unrejected elements only to new hash, so that the change on the original receiver can affect. [ruby-core:58914] [Bug #9223] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c: should not store local variable addressnobu2013-11-301-0/+10
| | | | | | | | * enumerator.c (enumerator_with_index): should not store local variable address to memoise the arguments. it is invalidated after the return. [ruby-core:58692] [Bug #9178] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Allow Enumerator size argument to be any callable.marcandre2013-08-271-0/+3
| | | | | | | | Patch by Avdi Grimm. [bug #8641] [ruby-core:56032] [fix GH-362] * test/ruby/test_enumerator.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add a frozenness check to Enumerator::Generator#initialize.knu2013-07-291-0/+5
| | | | | | * enumerator.c (generator_init): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add a frozenness check to Enumerator#initialize.knu2013-07-291-0/+10
| | | | | | | | | | * enumerator.c (enumerator_init): Add a frozenness check to prevent a frozen Enumerator object from being reinitialized with a different enumerable object. This is the least we should do, and more fixes will follow. [Fixes GH-368] Patch by Kenichi Kamiya. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c: use VALUEnobu2013-05-181-0/+8
| | | | | | | * enumerator.c (inspect_enumerator): use VALUE instead of mere char* by using rb_sprintf() and rb_id2str(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_with_index): try to convert given offset tonaruse2013-03-111-0/+12
| | | | | | integer. fix bug introduced in r39594. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c: allow Bignum for with_indexnobu2013-03-051-0/+8
| | | | | | | | | * enumerator.c (enumerator_with_index_i): allow Bignum as offset, to get rid of conversion exception and integer overflow. [ruby-dev:47131] [Bug #8010] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix tests of rb_warning().knu2012-11-241-2/+2
| | | | | | | | | | * test/ruby/envutil.rb (Test::Unit::Assertions#assert_warning) (Test::Unit::Assertions#assert_warn), test/ruby/envutil.rb, test/ruby/test_enumerator.rb, test/ruby/test_io_m17n.rb, test/ruby/test_regexp.rb, test/ruby/test_syntax.rb: assert_warn() and assert_warning() are reversed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert of 37541 "* test/ruby/test_enumerator.rb: Add test to shed light upon ↵marcandre2012-11-101-3/+0
| | | | | | | | | the bug" [#7298] This reverts commit 0ab21f9572d5d5f76b908aaf3381cde32a64c4c8. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_enumerator.rb: Add test to shed light upon the bugayumin2012-11-071-0/+3
| | | | | | which made by r37498. See http://bugs.ruby-lang.org/issues/7298 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: Support for String#{each_byte,each_char,each_codepoint}.sizemarcandre2012-11-061-0/+6
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (int_dotimes): Support for Integer#times.sizemarcandre2012-11-061-0/+1
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (int_upto, int_downto): Support for Integer#{down|up}to.sizemarcandre2012-11-061-0/+6
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * range.c: Support for range.step.sizemarcandre2012-11-061-0/+6
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_step): Support for Numeric#step.sizemarcandre2012-11-061-0/+15
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * struct.c: Support for Struct's enumerators #sizemarcandre2012-11-061-0/+7
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c: Support for enumerators created by ENV:marcandre2012-11-061-0/+6
| | | | | | | each, each_value, ... [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c: Support for enumerators created by Hash:marcandre2012-11-061-0/+7
| | | | | | | delete_if, reject!, ... [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_cycle): Support for Enumerable#cycle.sizemarcandre2012-11-061-0/+5
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_each_cons): Support for Enumerable#each_cons.sizemarcandre2012-11-061-0/+7
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_each_slice): Support for Enumerable#each_slice.sizemarcandre2012-11-061-0/+8
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c: Support for enumerators created by Enumerable with forwarding:marcandre2012-11-061-0/+14
| | | | | | | find_all, reject, ... [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_eval.c (rb_f_loop): Support for loop.sizemarcandre2012-11-061-0/+4
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_cycle): Support for Array#cycle.sizemarcandre2012-11-061-0/+8
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_repeated_combination): Support for repeated_combination.sizemarcandre2012-11-061-0/+5
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_repeated_permutation): Support for repeated_permutation.sizemarcandre2012-11-061-0/+4
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_combination): Support for Array#combination.sizemarcandre2012-11-061-0/+5
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): Support for Array#permutation.sizemarcandre2012-11-061-0/+13
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: Support for Enumerator#size in trivial cases:marcandre2012-11-061-0/+9
| | | | | | | | each, each_index, reverse_each, sort_by, collect, collect!, select, select!, keep_if, reject, reject!, delete_if [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Support #size for enumerators created from enumeratorsmarcandre2012-11-061-0/+6
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (obj_to_enum): Have #to_enum accept a blockmarcandre2012-11-061-0/+3
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator: New method #size; constructor accepts sizemarcandre2012-11-061-0/+10
| | | | | | | | | [Feature #6636] * include/ruby/intern.h: RETURN_SIZED_ENUMERATOR for support of sized enumerators git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_initialize): Warn when using deprecated formmarcandre2012-11-061-1/+4
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_enumerator.rb (enum_test, test_inspect): remove unusednagachika2012-09-301-2/+1
| | | | | | variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (inspect_enumerator): suppress uninitializednobu2012-04-031-0/+7
| | | | | | | | instance variable warnings. [ruby-dev:45449][Bug #6214] patched by no6v (Nobuhiro IMAI). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_each, generator_each): pass arguments tonobu2012-03-081-0/+19
| | | | | | | the block with yielder. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_enumerator.rb (test_nested_iteration): fix typo.nobu2012-01-101-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_array.rb: add a test for Array#rotate, rotate!.mame2010-01-221-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/ruby/test_dir.rb, test/ruby/test_fnmatch.rb: add some tests (for coverage of dir.c). * test/ruby/test_enum.rb: add a test for Enumerable#minmax. * test/ruby/test_enumerator.rb: add some tests for Enumerator#inspect, Enumerator::Generator and Yielder. * test/ruby/test_env.rb: add a test for ENV#index. * test/ruby/test_exception.rb: add some tests (for coverage of error.c). * test/ruby/test_hash.rb: add a test for recursive check. * test/ruby/test_integer.rb: add a test for number of argument of Integer. * test/ruby/test_method.rb: add a test for define_method. * test/ruby/test_module.rb: add a test for constant of included module. * test/ruby/test_proc.rb: add a test for parameters with cfunc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (ary2sv): add dup argument.akr2009-08-211-0/+22
| | | | | | | | | | | (enumerator_next): call ary2sv with dup=0. (enumerator_peek): call ary2sv with dup=1 to return duplicated array. (enumerator_peek_values_m): new function to return duplicated array. (Init_Enumerator): use enumerator_peek_values_m as Enumerator#peek_value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e