From 0a69f2e39de67d3d9887673b5030adcc5f2d0b81 Mon Sep 17 00:00:00 2001 From: sorah Date: Sat, 9 Apr 2011 13:01:23 +0000 Subject: * 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 --- test/stringio/test_stringio.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/stringio') 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 -- cgit v1.2.3