From ee388f6ee2790908dffbb4b20d7d1d43b8ddb38a Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 4 Nov 2010 15:39:07 +0000 Subject: * io.c (rb_io_readlines, rb_io_each_line): limit must not be zero. a patch from Tomoyuki Chikanaga at [ruby-dev:42538]. #4024 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index af7f428ec4..73a16de4cc 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1702,4 +1702,24 @@ End GC.start end end + + def test_readlines_limit_0 + bug4024 = '[ruby-dev:42538]' + t = make_tempfile + open(t.path, "r") do |io| + assert_raise(ArgumentError, bug4024) do + io.readlines(0) + end + end + end + + def test_each_line_limit_0 + bug4024 = '[ruby-dev:42538]' + t = make_tempfile + open(t.path, "r") do |io| + assert_raise(ArgumentError, bug4024) do + io.each_line(0).next + end + end + end end -- cgit v1.2.3