mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* enumerator.c: Support for lazy.{map|flat_map|...}.size
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c8426ce840
commit
5dbbfc3b34
2 changed files with 22 additions and 12 deletions
|
@ -328,5 +328,13 @@ EOS
|
|||
lazy = [1, 2, 3].lazy
|
||||
assert_equal 3, lazy.size
|
||||
assert_equal 42, Enumerator.new(42){}.lazy.size
|
||||
%i[map collect flat_map collect_concat].each do |m|
|
||||
assert_equal 3, lazy.send(m){}.size
|
||||
end
|
||||
assert_equal 3, lazy.zip([4]).size
|
||||
%i[select find_all reject take_while drop_while].each do |m|
|
||||
assert_equal nil, lazy.send(m){}.size
|
||||
end
|
||||
assert_equal nil, lazy.grep(//).size
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue