diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-04 15:39:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-04 15:39:07 +0000 |
commit | ee388f6ee2790908dffbb4b20d7d1d43b8ddb38a (patch) | |
tree | d6d670f3291a06ae4be3b47a5c7d4eb70d5680dc /test/ruby/test_io.rb | |
parent | e2a62c218c9abcd0759d176e9865920fad8f8d9d (diff) | |
download | ruby-ee388f6ee2790908dffbb4b20d7d1d43b8ddb38a.tar.gz |
* 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
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r-- | test/ruby/test_io.rb | 20 |
1 files changed, 20 insertions, 0 deletions
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 |