mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 22:14:37 +02:00
enum.c: check argument first
* 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
This commit is contained in:
parent
6c1f11592c
commit
4b7f531553
3 changed files with 13 additions and 8 deletions
|
@ -590,6 +590,8 @@ class TestEnumerator < Test::Unit::TestCase
|
|||
assert_equal 126, @sized.cycle(3).size
|
||||
assert_equal Float::INFINITY, [].to_enum { 42 }.cycle.size
|
||||
assert_equal 0, [].to_enum { 0 }.cycle.size
|
||||
|
||||
assert_raise(TypeError) {[].to_enum { 0 }.cycle("").size}
|
||||
end
|
||||
|
||||
def test_size_for_loops
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue