summaryrefslogtreecommitdiff
path: root/test/stringio
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-21 05:11:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-21 05:11:50 +0000
commit90e393b3687d783f7820a9f6055c6bb5a94f85a1 (patch)
treea35dc7807fd0bb02174f22e9def8e58e5f080272 /test/stringio
parent862618d224b29f794d88e503fe16d041e5b6f1b7 (diff)
stringio.c: non-ascii encoding
* 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/trunk@45646 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 f29322b..c7db91a 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -419,6 +419,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) }