summaryrefslogtreecommitdiff
path: root/test/stringio
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-28 04:19:08 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-28 04:19:08 +0000
commit320eae266023d61e2e1f21211d85d93fc534c336 (patch)
treeb1a1848aec44139881057d32464218ece888b716 /test/stringio
parente63338f6fbac8339c58f74e606262d9726ad64cf (diff)
merge revision(s) 45646: [Backport #9765]
* ext/stringio/stringio.c (strio_putc): fix for non-ascii encoding, like as IO#putc. [ruby-dev:48114] [Bug #9765] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/stringio')
-rw-r--r--test/stringio/test_stringio.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb
index 0eceeba894..a2a2365149 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -411,6 +411,22 @@ class TestStringIO < Test::Unit::TestCase
assert_equal("foo123", s)
end
+ def test_putc_nonascii
+ s = ""
+ f = StringIO.new(s, "w")
+ f.putc("\u{3042}")
+ f.putc(0x3044)
+ f.close
+ assert_equal("\u{3042}D", s)
+
+ s = "foo"
+ f = StringIO.new(s, "a")
+ f.putc("\u{3042}")
+ f.putc(0x3044)
+ f.close
+ assert_equal("foo\u{3042}D", s)
+ end
+
def test_read
f = StringIO.new("\u3042\u3044")
assert_raise(ArgumentError) { f.read(-1) }