diff options
author | sorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-04-09 13:01:23 +0000 |
---|---|---|
committer | sorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-04-09 13:01:23 +0000 |
commit | 0a69f2e39de67d3d9887673b5030adcc5f2d0b81 (patch) | |
tree | 97d3eedd4703e3db789ed9570fdd7cea31606337 /test | |
parent | 699c3de19016690c3901641ca3d0d40822558f05 (diff) | |
download | ruby-0a69f2e39de67d3d9887673b5030adcc5f2d0b81.tar.gz |
* ext/stringio/stringio.c (strio_each, strio_readlines):
limit must not be zero. Fixes [ruby-dev:43392].
* test/stringio/test_stringio.rb: Add tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/stringio/test_stringio.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index c581681817..8bf6c595a0 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -482,4 +482,12 @@ class TestStringIO < Test::Unit::TestCase assert_raise(RuntimeError, bug) {s.string = "foo"} assert_raise(RuntimeError, bug) {s.reopen("")} end + + def test_readlines_limit_0 + assert_raise(ArgumentError, "[ruby-dev:43392]") { StringIO.new.readlines(0) } + end + + def test_each_line_limit_0 + assert_raise(ArgumentError, "[ruby-dev:43392]") { StringIO.new.each_line(0) } + end end |