diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-11 22:49:15 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-11 22:49:15 +0000 |
commit | 61f512a3575df2ca3c894c426d47cdc27ca8d4fd (patch) | |
tree | 6c8bc280c933afe5d615fa74747c8ad48abea7bc /test/ruby/test_transcode.rb | |
parent | 94ca2d94deca939e6e50c09705873eb89c6012aa (diff) | |
download | ruby-61f512a3575df2ca3c894c426d47cdc27ca8d4fd.tar.gz |
add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_transcode.rb')
-rw-r--r-- | test/ruby/test_transcode.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb index d3bcb77c35..5d38274523 100644 --- a/test/ruby/test_transcode.rb +++ b/test/ruby/test_transcode.rb @@ -252,6 +252,13 @@ class TestTranscode < Test::Unit::TestCase "\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)) + + assert_equal("\e$B!!\e(B".force_encoding("ISO-2022-JP"), + "\xA1\xA1\xFF".encode("ISO-2022-JP", "EUC-JP", invalid: :ignore)) + assert_equal("\e$B\x24\x22\x24\x24\e(B".force_encoding("ISO-2022-JP"), + "\xA4\xA2\xFF\xA4\xA4".encode("ISO-2022-JP", "EUC-JP", invalid: :ignore)) + assert_equal("\e$B\x24\x22\x24\x24\e(B".force_encoding("ISO-2022-JP"), + "\xA4\xA2\xFF\xFF\xA4\xA4".encode("ISO-2022-JP", "EUC-JP", invalid: :ignore)) end def test_invalid_replace @@ -306,6 +313,10 @@ class TestTranscode < Test::Unit::TestCase assert_equal("\e$B!!\e(B?".force_encoding("ISO-2022-JP"), "\xA1\xA1\xFF".encode("ISO-2022-JP", "EUC-JP", invalid: :replace)) + assert_equal("\e$B\x24\x22\e(B?\e$B\x24\x24\e(B".force_encoding("ISO-2022-JP"), + "\xA4\xA2\xFF\xA4\xA4".encode("ISO-2022-JP", "EUC-JP", invalid: :replace)) + assert_equal("\e$B\x24\x22\e(B??\e$B\x24\x24\e(B".force_encoding("ISO-2022-JP"), + "\xA4\xA2\xFF\xFF\xA4\xA4".encode("ISO-2022-JP", "EUC-JP", invalid: :replace)) end def test_undef_replace |