From a70f475dbbdd0e8f2b14d98aefc3d01fc5af3d17 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 29 Nov 2004 07:06:21 +0000 Subject: * ext/stringio/stringio.c (strio_write): insufficiently filled string being extended when overwriting. [ruby-core:03836] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/stringio/test_stringio.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/stringio/test_stringio.rb') diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index fee305e856..de15ab5508 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -30,4 +30,14 @@ class TestStringIO < Test::Unit::TestCase io.print "last" assert_equal("\0" * n + "last", io.string) end + + def test_overwrite # [ruby-core:03836] + stringio = StringIO.new + responses = ['', 'just another ruby', 'hacker'] + responses.each do |resp| + stringio.puts(resp) + stringio.rewind + end + assert_equal("hacker\nother ruby\n", stringio.string) + end end -- cgit v1.2.3