ruby-changes:6986
From: akr <ko1@a...>
Date: Tue, 12 Aug 2008 07:49:27 +0900 (JST)
Subject: [ruby-changes:6986] Ruby:r18504 (trunk): add a test.
akr 2008-08-12 07:49:15 +0900 (Tue, 12 Aug 2008) New Revision: 18504 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18504 Log: add a test. Modified files: trunk/test/ruby/test_transcode.rb Index: test/ruby/test_transcode.rb =================================================================== --- test/ruby/test_transcode.rb (revision 18503) +++ test/ruby/test_transcode.rb (revision 18504) @@ -252,6 +252,13 @@ "\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 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/