summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-03 11:29:33 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-03 11:29:33 +0000
commit9998481d4efaf86dde652617ed3b2777924c3373 (patch)
tree5a57bb69e829bd106462105dd3b638a618d16e35 /test/ruby
parent342ed0ab03b951916cf77058f2e09c0e887cfdc2 (diff)
* enc/trans/gb18030-tbl.rb: Fix omission of C1 region in code table
(from Tatsuya Mizuno) * test/ruby/test_transcode.rb: Added test for converting full range of Unicode codepoints from/to GB18030 (from Tatsuya Mizuno) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_transcode.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb
index 2cc23bae8f..bec153b491 100644
--- a/test/ruby/test_transcode.rb
+++ b/test/ruby/test_transcode.rb
@@ -1578,7 +1578,13 @@ class TestTranscode < Test::Unit::TestCase
end
def test_gb18030
- # test from GBK
+ # overall roundtrip test
+ all_gb18030 = (0x0..0xD7FF).to_a.pack 'U*' #追加
+ all_gb18030 << (0xE000..0xFFFF).to_a.pack("U*") #追加
+
+ assert_equal(all_gb18030, all_gb18030.encode("gb18030").encode("UTF-8")) #追加
+
+ # tests from GBK
check_both_ways("\u4E02", "\x81\x40", 'GB18030') #
check_both_ways("\u4E8A", "\x81\x7E", 'GB18030') #
check_both_ways("\u4E90", "\x81\x80", 'GB18030') #
@@ -1691,7 +1697,7 @@ class TestTranscode < Test::Unit::TestCase
check_both_ways("\u9752\u5C71\u5B66\u9662\u5927\u5B66", "\xC7\xE0\xC9\xBD\xD1\xA7\xD4\xBA\xB4\xF3\xD1\xA7", 'GB18030') # 青山学院大学
check_both_ways("\u795E\u6797\u7FA9\u535A", "\xC9\xF1\xC1\xD6\xC1\x78\xB2\xA9", 'GB18030') # 神林義
- # new tests for GB18030
+ # new tests for GB18030
check_both_ways("\u9FA6", "\x82\x35\x8F\x33", 'GB18030') # 龦
check_both_ways("\uD7FF", "\x83\x36\xC7\x38", 'GB18030') # No name ()