From 0ff4061ef7e3a8ffa681698fa8490740616d1aac Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 17 Aug 2008 12:54:26 +0000 Subject: * io.c (prepare_getline_args): io.gets(10,nil) should cause TypeError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/ruby/test_io.rb') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index d4a51cc8dc..0c41847c52 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -44,6 +44,15 @@ class TestIO < Test::Unit::TestCase r.close end + def test_gets_limit_extra_arg + with_pipe {|r, w| + r, w = IO.pipe + w << "0123456789" + w.close + assert_raise(TypeError) { r.gets(3,nil) } + } + end + # This test cause SEGV. def test_ungetc r, w = IO.pipe -- cgit v1.2.3