diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-05 03:49:59 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-05 03:49:59 +0000 |
commit | 1677cbce9d7c72cca83d1b7d48cb85a17e74abcc (patch) | |
tree | cc1dd1c678470e3c26343e054f5443ff1eac77bb /test/ruby/test_lazy_enumerator.rb | |
parent | 44cd5f21e9d06ccc09ba8e12fb53d64f0df059a3 (diff) |
* enumerator.c: Use to_enum for Enumerable methods returning Enumerators.
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
Diffstat (limited to 'test/ruby/test_lazy_enumerator.rb')
-rw-r--r-- | test/ruby/test_lazy_enumerator.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb index 8e0fd50f55..c78a2d66cc 100644 --- a/test/ruby/test_lazy_enumerator.rb +++ b/test/ruby/test_lazy_enumerator.rb @@ -447,4 +447,20 @@ EOS assert_raise(ArgumentError){ [].lazy.send(method) } end end + + def test_laziness_conservation + bug7507 = '[ruby-core:51510]' + { + slice_before: //, + with_index: nil, + cycle: nil, + each_with_object: 42, + each_slice: 42, + each_entry: nil, + each_cons: 42, + }.each do |method, arg| + assert_equal Enumerator::Lazy, [].lazy.send(method, *arg).class, bug7507 + end + assert_equal Enumerator::Lazy, [].lazy.chunk{}.class, bug7507 + end end |