From 1b91d48bf9059d295edb865b9a6ebbb2c397c617 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: http://svn.ruby-lang.org/repos/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 d4a51cc8d..0c41847c5 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