From 6602bc193b378f832e52f446df8804efafd5dfb8 Mon Sep 17 00:00:00 2001 From: usa Date: Mon, 30 Nov 2015 12:19:43 +0000 Subject: merge revision(s) 52745: [Backport #11738] * io.c (argf_getpartial): should not resize str if the second argument is not given. [ruby-core:71668] [Bug #11738] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@52800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_argf.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb index fb869561a1..104a681ee0 100644 --- a/test/ruby/test_argf.rb +++ b/test/ruby/test_argf.rb @@ -504,6 +504,17 @@ class TestArgf < Test::Unit::TestCase end end + def test_readpartial_eof_twice + ruby('-W1', '-e', <<-SRC, @t1.path) do |f| + $stderr = $stdout + print ARGF.readpartial(256) + ARGF.readpartial(256) rescue p($!.class) + ARGF.readpartial(256) rescue p($!.class) + SRC + assert_equal("1\n2\nEOFError\nEOFError\n", f.read) + end + end + def test_getc ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f| s = "" -- cgit v1.2.3