diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-15 00:12:05 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-15 00:12:05 +0000 |
commit | 61ee785c61da48a23112727e763bd465a81a37ba (patch) | |
tree | f79f270f0a84ccb68c419553c86ef2b3316e5753 /test/ruby/test_io_m17n.rb | |
parent | 3f4a73f0e1d79184c51d3d696ec06376c323e0b5 (diff) | |
download | ruby-61ee785c61da48a23112727e763bd465a81a37ba.tar.gz |
* io.c (rb_io_puts): fix for wide char encoding strings.
[ruby-dev:42212]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io_m17n.rb')
-rw-r--r-- | test/ruby/test_io_m17n.rb | 18 |
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 |