summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-24 09:37:02 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-24 09:37:02 +0000
commit14dfd98ee47d0f0106d3c9f0a5793688381f941a (patch)
treeb247b82dd24f2f2060cedb492f6a0afd3a793018 /test
parentc2a3a47f40c5884a2f867ae90b1d2fb8172e3925 (diff)
merges r29256 from trunk into ruby_1_9_2.
-- * io.c (rb_io_puts): fix for wide char encoding strings. [ruby-dev:42212] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@29909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io_m17n.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index 21b7941cbe..3d3b64c6cc 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -1833,5 +1833,23 @@ EOT
assert_equal((bug3534[1]+"\n").encode(e), r.gets(), bug3534[1])
end
end
+
+ def test_puts_widechar
+ bug = '[ruby-dev:42212]'
+ r, w = IO.pipe(Encoding::ASCII_8BIT)
+ r.binmode
+ w.binmode
+ w.puts(0x010a.chr(Encoding::UTF_32BE))
+ w.puts(0x010a.chr(Encoding::UTF_16BE))
+ w.puts(0x0a010000.chr(Encoding::UTF_32LE))
+ w.puts(0x0a01.chr(Encoding::UTF_16LE))
+ w.close
+ assert_equal("\x00\x00\x01\x0a\n", r.read(5), bug)
+ assert_equal("\x01\x0a\n", r.read(3), bug)
+ assert_equal("\x00\x00\x01\x0a\n", r.read(5), bug)
+ assert_equal("\x01\x0a\n", r.read(3), bug)
+ assert_equal("", r.read, bug)
+ r.close
+ end
end