* test/ruby/test_transcode.rb: add tests for iso-2022-jp.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4a14d3c04b
commit
d6ada9f14b
@ -1,3 +1,7 @@
|
|||||||
|
Thu Jun 5 01:47:18 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* test/ruby/test_transcode.rb: add tests for iso-2022-jp.
|
||||||
|
|
||||||
Thu Jun 5 01:27:42 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
Thu Jun 5 01:27:42 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
* test/ruby/test_process.rb: add tests.
|
* test/ruby/test_process.rb: add tests.
|
||||||
|
@ -253,4 +253,19 @@ class TestTranscode < Test::Unit::TestCase
|
|||||||
assert_equal(''.force_encoding('UTF-16BE'),
|
assert_equal(''.force_encoding('UTF-16BE'),
|
||||||
"\x82\xAB".encode('UTF-16BE', 'UTF-8', invalid: :ignore))
|
"\x82\xAB".encode('UTF-16BE', 'UTF-8', invalid: :ignore))
|
||||||
end
|
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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user