diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-05 23:32:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-05 23:32:50 +0000 |
commit | 4b7f531553100afad272c7078b23e6e32989bc2a (patch) | |
tree | 454c368ed3e59dcc7071d7e9079611c9b7610487 /test/ruby/test_enumerator.rb | |
parent | 6c1f11592c6e8f5347b758e66c869bde7ca32733 (diff) |
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
Diffstat (limited to 'test/ruby/test_enumerator.rb')
-rw-r--r-- | test/ruby/test_enumerator.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb index 0ee11dad36..51f69be37d 100644 --- a/test/ruby/test_enumerator.rb +++ b/test/ruby/test_enumerator.rb @@ -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 |