diff options
author | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-16 09:09:53 +0000 |
---|---|---|
committer | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-16 09:09:53 +0000 |
commit | 2e7815dd8000dc4d3ef7f2443bf5fd045812ee9e (patch) | |
tree | 452e9c4f33f7c02ea1d088ddb525a836f4ec4037 /test | |
parent | 9e202f9398d683c0b4538810d21257fd4bca9de9 (diff) | |
download | ruby-2e7815dd8000dc4d3ef7f2443bf5fd045812ee9e.tar.gz |
Sun Mar 16 18:07:07 2008 Martin Duerst <duerst@it.aoyama.ac.jp>
* enc/trans/utf_16_32.c: bug fix (some invalid UTF-8 sequences
were legal)
* test/ruby/test_transcode.rb: test for above bug
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_transcode.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb index 5a704fd364..e4bad8e38a 100644 --- a/test/ruby/test_transcode.rb +++ b/test/ruby/test_transcode.rb @@ -3,7 +3,7 @@ require 'test/unit' class TestTranscode < Test::Unit::TestCase - def setup # trick to create all the necessary encodings + def setup_really_needed? # trick to create all the necessary encodings all_encodings = [ 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6', @@ -248,5 +248,9 @@ class TestTranscode < Test::Unit::TestCase "\x41\xC2\x3E\x42".encode('UTF-16BE', 'UTF-8', invalid: :ignore)) assert_equal("\x00\x41\x00\xF1\x00\x42".force_encoding('UTF-16BE'), "\x41\xC2\xC3\xB1\x42".encode('UTF-16BE', 'UTF-8', invalid: :ignore)) + assert_equal("\x00\x42".force_encoding('UTF-16BE'), + "\xF0\x80\x80\x42".encode('UTF-16BE', 'UTF-8', invalid: :ignore)) + assert_equal(''.force_encoding('UTF-16BE'), + "\x82\xAB".encode('UTF-16BE', 'UTF-8', invalid: :ignore)) end end |