ruby-changes:5320
From: mame <ko1@a...>
Date: Thu, 5 Jun 2008 01:48:26 +0900 (JST)
Subject: [ruby-changes:5320] Ruby:r16821 (trunk): * test/ruby/test_transcode.rb: add tests for iso-2022-jp.
mame 2008-06-05 01:48:07 +0900 (Thu, 05 Jun 2008)
New Revision: 16821
Modified files:
trunk/ChangeLog
trunk/test/ruby/test_transcode.rb
Log:
* test/ruby/test_transcode.rb: add tests for iso-2022-jp.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_transcode.rb?r1=16821&r2=16820&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16821&r2=16820&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 16820)
+++ ChangeLog (revision 16821)
@@ -1,3 +1,7 @@
+Thu Jun 5 01:47:18 2008 Yusuke Endoh <mame@t...>
+
+ * test/ruby/test_transcode.rb: add tests for iso-2022-jp.
+
Thu Jun 5 01:27:42 2008 Yusuke Endoh <mame@t...>
* test/ruby/test_process.rb: add tests.
Index: test/ruby/test_transcode.rb
===================================================================
--- test/ruby/test_transcode.rb (revision 16820)
+++ test/ruby/test_transcode.rb (revision 16821)
@@ -253,4 +253,19 @@
assert_equal(''.force_encoding('UTF-16BE'),
"\x82\xAB".encode('UTF-16BE', 'UTF-8', invalid: :ignore))
end
+
+ def test_iso_2022_jp
+ assert_raise(RuntimeError) { "\x1b(A".encode("utf-8", "iso-2022-jp") }
+ assert_raise(RuntimeError) { "\x1b$(A".encode("utf-8", "iso-2022-jp") }
+ assert_equal("\uff71\uff72\uff73\uff74\uff75",
+ "\x1b(I12345\x1b(B".force_encoding("iso-2022-jp").encode("utf-8"))
+ assert_equal("\u9299", "\x1b$(Dd!\x1b(B".encode("utf-8", "iso-2022-jp"))
+ assert_raise(RuntimeError) { "\x1b$C".encode("utf-8", "iso-2022-jp") }
+ assert_raise(RuntimeError) { "\x1e".encode("utf-8", "iso-2022-jp") }
+ assert_raise(RuntimeError) { "\x80".encode("utf-8", "iso-2022-jp") }
+
+ assert_equal("\x1b(I12345\x1b(B".force_encoding("iso-2022-jp"),
+ "\uff71\uff72\uff73\uff74\uff75".encode("iso-2022-jp"))
+ assert_equal("\x1b$(Dd!\x1b(B".force_encoding("iso-2022-jp"), "\u9299".encode("iso-2022-jp"))
+ end
end
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/