aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_lazy_enumerator.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add test for Enumerator::Lazy#takenobu2015-12-311-0/+5
| | | | | | | | * test/ruby/test_lazy_enumerator.rb (test_take_bad_arg): Add test code in case of Enumerator::Lazy#take called with negative number. [ruby-dev:49467] [Bug #11933] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c (vm_make_proc_from_block): should convert a Symbol to a Proc.shugo2015-12-161-0/+7
| | | | | | [ruby-core:72083] [Bug #11811] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53152 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
* enumerator.c: lazy_grep_vnobu2015-12-081-0/+28
| | | | | | | | * enumerator.c (lazy_grep_v): add Enumerator::Lazy#grep_v as well as Enumerable, to enumerate lazily. [ruby-core:71845] [Feature #11773] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: Fixnum onlynobu2015-02-281-0/+12
| | | | | | | * enum.c (limit_by_enum_size, enum_size_over_p): check only against Fixnum size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49782 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
* * enum.c (enum_slice_when): New method: Enumerable#slice_when.akr2014-09-201-0/+1
| | | | | | | | | | | | | | (slicewhen_i): New function. (slicewhen_ii): New function. * enumerator.c (InitVM_Enumerator): New method: Enumerator::Lazy#slice_when. [ruby-core:62499] [Feature #9826] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c: Enumerable#slice_after implemented.akr2014-05-181-0/+1
| | | | | | | | | | * enumerator.c: Enumerator::Lazy#slice_after implemented. Requested by Tsuyoshi Sawada. [ruby-core:58123] [Feature #9071] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby: get rid of warnings.usa2014-03-051-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c: fix non-single argumentnobu2013-08-081-0/+12
| | | | | | | | * enumerator.c (lazy_zip_func): fix non-single argument. fix out-of-bound access and pack multiple yielded values. [ruby-core:56383] [Bug #8735] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add a frozenness check test for Enumerator::Lazy#initialize.knu2013-07-291-0/+6
| | | | | | | | | | * test/ruby/test_lazy_enumerator.rb (TestLazyEnumerator#test_initialize): Make sure Enumerator::Lazy#initialize raises error if the object is frozen. The check was performed by rb_ivar_set() before rb_check_frozen() was added to enumerator_init(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Message is 3rd argument, not 2ndnaruse2013-06-181-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39711 ↵headius2013-03-101-3/+3
| | | | b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enumerator.c: suppress warningsnobu2013-02-201-0/+9
| | | | | | | | * enumerator.c (lazy_zip_arrays_func, lazy_zip_func, lazy_take_func), (lazy_drop_func, lazy_drop_while_func): suppress uninitialized instance vriable warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Use to_enum for Enumerable methods returning Enumerators.marcandre2013-02-051-0/+16
| | | | | | | | | | | | | | This makes Lazy#cycle no longer needed, so it was removed. Make Enumerator#chunk and slice_before return lazy Enumerators. [Bug #7715] * internal.h: Remove ref to rb_enum_cycle_size; no longer needed * enum.c: Make enum_cycle_size static. * test/ruby/test_lazy_enumerator.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Finalize and document Lazy.new. [Bug #7248]marcandre2013-02-051-6/+21
| | | | | | | | Add Lazy#to_enum and simplify Lazy#size. * test/ruby/test_lazy_enumerator.rb: tests for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_zip): raise error for bad argumentsmarcandre2013-01-241-0/+5
| | | | | | [Bug #7706] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Optimize Lazy#zip when passed only arraysmarcandre2013-01-241-0/+14
| | | | | | [Bug #7706] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Fix state handling for Lazy#zipmarcandre2013-01-241-0/+8
| | | | | | | | [bug #7696] [bug #7691] * test/ruby/test_lazy_enumerator.rb: test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Fix state handling for Lazy#dropmarcandre2013-01-241-0/+7
| | | | | | | | [bug #7696] [bug #7691] * test/ruby/test_lazy_enumerator.rb: test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Fix state handling for Lazy#drop_whilemarcandre2013-01-241-0/+7
| | | | | | | | [bug #7696] [bug #7691] * test/ruby/test_lazy_enumerator.rb: test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Fix state handling for Lazy#takemarcandre2013-01-241-0/+17
| | | | | | | | [bug #7696] * test/ruby/test_lazy_enumerator.rb: test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test_lazy_enumerator: Test that map & flat_map also require a blockmarcandre2013-01-151-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_flat_map_func): flat_map should call each onlyshugo2013-01-141-0/+5
| | | | | | | | | | | when the value of a block returns a forcable object. [ruby-core:51401] [Bug #7690] * enumerator.c (lazy_flat_map): add documentation. * test/ruby/test_lazy_enumerator.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Require block for Lazy#{take|drop}_while [Bug #7692]marcandre2013-01-141-0/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Fix size for Enumerator::Lazy#flat_mapmarcandre2013-01-141-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: save blockprocvalnobu2012-12-051-0/+7
| | | | | | | * vm.c (rb_vm_make_proc): save the proc made from the given block so that it will not get collected. [ruby-core:50545] [Bug #7507] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix test to follow r37838naruse2012-11-251-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Support for lazy.cycle.sizemarcandre2012-11-061-0/+9
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Add support for lazy.drop.sizemarcandre2012-11-061-0/+5
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Support for lazy.take.sizemarcandre2012-11-061-0/+5
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Support for lazy.{map|flat_map|...}.sizemarcandre2012-11-061-0/+8
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Support for lazy.sizemarcandre2012-11-061-0/+6
| | | | | | [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_lazy_enumerator.rb: test for cycle chainnobu2012-07-271-1/+2
| | | | | | | | * test/ruby/test_lazy_enumerator.rb (test_cycle_chain): more test for infinite sequence. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_lazy_enumerator.rb: test for cycle chainnobu2012-07-271-0/+6
| | | | | | | | * test/ruby/test_lazy_enumerator.rb (test_cycle_chain): more test for infinite sequence. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_take_func, lazy_take): multiple calls ofnagachika2012-05-131-0/+8
| | | | | | | | | | force/to_a method to Enumerator::Lazy#take should return same results. [ruby-dev:45634] [Bug #6428] * test/ruby/test_lazy_enumerator.rb (test_take_recycle): add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (inspect_enumerator): show method arguments ofshugo2012-03-261-2/+14
| | | | | | lazy enumerators correctly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator (lazy_initialize): set the instance variable "receiver"shugo2012-03-241-0/+4
| | | | | | | | | to include the receiver to the return value of inspect on a lazy enumerator directly created by Enumerator::Lazy.new. * enumerator (RETURN_LAZY): don't set the instance variable "receiver". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator (enumerator_inspect): include the original receiver andshugo2012-03-241-0/+12
| | | | | | | | | | | method name of Enumerator::Lazy in the result of inspect. [ruby-core:43345] [Bug #6159] * enumerator (InitVM_Enumerator): don't use rb_define_alias for some methods such as collect in order to make rb_frame_this_func() return the correct method names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_flat_map_func): convert the block value toshugo2012-03-191-0/+21
| | | | | | | Array if it doesn't respond to each. [ruby-core:43334] [Bug #6155] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_take): don't enumerate an extra value.shugo2012-03-161-1/+5
| | | | | | [ruby-dev:45370] [Bug #6152] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (rb_enum_values_pack): rename from enum_values_pack, andshugo2012-03-151-0/+42
| | | | | | | | | | | | | remove static. * enumerator.c (lazy_init_iterator, lazy_init_yielder, lazy_select_func, lazy_reject_func, lazy_grep_func): handle multiple values correctly. * enumerator.c (lazy_grep): change the behavior when a block is given, to be consistent with Enumerable#grep. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_zip): rescue StopIteration returned byshugo2012-03-151-0/+6
| | | | | | Enumerator#next. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_zip, lazy_cycle): Enumerator::Lazy#{zip,cycle}shugo2012-03-151-4/+14
| | | | | | | should be eager when a block is given, to be consistent with Enumerable#{zip,cycle}. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (InitVM_Enumerator): renamed Enumerable::Lazy toshugo2012-03-151-1/+1
| | | | | | Enumerator::Lazy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_cycle): add Enumerable::Lazy#cycle.shugo2012-03-151-0/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_init_iterator): break when Qundef is returnedshugo2012-03-141-4/+40
| | | | | | | | | | | | | | | to make obj.drop(3).take(2) work properly. * enumerator.c (lazy_take_while): add Enumerable::Lazy#take_while. * enumerator.c (lazy_drop): add Enumerable::Lazy#drop. * enumerator.c (lazy_drop_while): add Enumerable::Lazy#drop_while. * enumerator.c (InitVM_Enumerator): add Enumerable::Lazy#force as an alias of to_a. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_take): add Enumerable::Lazy#take.shugo2012-03-141-0/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (lazy_grep_func): should use === instead of =~, asnobu2012-03-141-0/+2
| | | | | | well as Enumerable#grep git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Init_Enumeratornobu2012-03-141-1/+1
| | | | | | * enumerator.c (Init_Enumerator): initialize method IDs first. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e