From 07f53e483042f8d154912b9414808ad40973cd44 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 18 Dec 2015 03:05:53 +0000 Subject: [PATCH] test_stringio.rb: add test * test/stringio/test_stringio.rb (test_ungetc_pos): add a test for r26588. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/stringio/test_stringio.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index 17ae9ab848..af6efc684e 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -572,6 +572,16 @@ class TestStringIO < Test::Unit::TestCase end end + def test_ungetc_padding + s = StringIO.new() + s.pos = 2 + s.ungetc("a") + assert_equal("\0""a", s.string) + s.pos = 0 + s.ungetc("b") + assert_equal("b""\0""a", s.string) + end + def test_frozen s = StringIO.new s.freeze