summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-11 21:23:35 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-11 21:23:35 +0000
commita3a5b7d3aca9399716286723b322fcc2c3be9650 (patch)
treee662dfab0fcddb6299040e913092c1331aab379b /test
parentfbb6e25a4dd755586fdb213c584d33e0e5bd35e6 (diff)
merges r30837 and r30839 from trunk into ruby_1_9_2.
-- * test/ruby: uniquify test names. -- * test/ruby/test_transcode.rb (test_from_cp50221): fix wrong assertion and move back. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io_m17n.rb2
-rw-r--r--test/ruby/test_transcode.rb13
2 files changed, 8 insertions, 7 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index 6f3a496761..39e6dd6538 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -184,7 +184,7 @@ EOT
}
end
- def test_open_r_encname_encname_in_opt
+ def test_open_r_externalencname_internalencname_in_opt
with_tmpdir {
generate_file('tmp', "")
open("tmp", "r", external_encoding: "euc-jp", internal_encoding: "utf-8") {|f|
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb
index a47184e970..123111e4cc 100644
--- a/test/ruby/test_transcode.rb
+++ b/test/ruby/test_transcode.rb
@@ -1357,7 +1357,7 @@ class TestTranscode < Test::Unit::TestCase
"\xA1\xA1".encode("ISO-2022-JP", "EUC-JP"))
end
- def test_cp50221
+ def test_from_cp50221
assert_equal("!", "\e(B\x21".encode("utf-8", "cp50221"))
assert_equal("!", "\e(J\x21".encode("utf-8", "cp50221"))
assert_equal("\uFF71", "\xB1".encode("utf-8", "cp50221"))
@@ -1373,10 +1373,11 @@ class TestTranscode < Test::Unit::TestCase
assert_equal("\u5fde", "\e$B\x7A\x21".encode("utf-8", "cp50221"))
assert_equal("\u72be", "\e$B\x7B\x21".encode("utf-8", "cp50221"))
assert_equal("\u91d7", "\e$B\x7C\x21".encode("utf-8", "cp50221"))
- assert_equal("\e(I!_\e(B", "\xA1\xDF".encode("cp50220","sjis"))
+ assert_equal("\xA1\xDF".force_encoding("sjis"),
+ "\e(I!_\e(B".encode("sjis","cp50220"))
end
- def test_cp50221
+ def test_to_cp50221
assert_equal("\e$B!#!,\e(B".force_encoding("cp50220"),
"\xA1\xDF".encode("cp50220","sjis"))
assert_equal("\e$B%*!+%,%I%J!+%N!+%P%\\%^!+%Q%]%\"\e(B".force_encoding("cp50220"),
@@ -1393,7 +1394,7 @@ class TestTranscode < Test::Unit::TestCase
"\x61\xF1\x80\x80\xE1\x80\xC2\x62".encode('UTF-16BE', 'UTF-8', invalid: :replace)) # option 2
assert_equal("\x61\x00\xFD\xFF\xFD\xFF\xFD\xFF\x62\x00".force_encoding('UTF-16LE'),
"\x61\xF1\x80\x80\xE1\x80\xC2\x62".encode('UTF-16LE', 'UTF-8', invalid: :replace)) # option 2
-
+
# additional clarification
assert_equal("\xFF\xFD\xFF\xFD\xFF\xFD\xFF\xFD".force_encoding('UTF-16BE'),
"\xF0\x80\x80\x80".encode('UTF-16BE', 'UTF-8', invalid: :replace))
@@ -1902,11 +1903,11 @@ class TestTranscode < Test::Unit::TestCase
#assert_raise(Encoding::UndefinedConversionError) { "\xF9\xD6".encode("utf-8", 'Big5-HKSCS') }
check_both_ways("\u795E\u6797\u7FA9\u535A", "\xAF\xAB\xAA\x4C\xB8\x71\xB3\xD5", 'Big5-HKSCS') # 神林義博
end
-
+
def test_Big5_UAO
check_both_ways("\u4e17", "\x81\x40", 'Big5-UAO') # 丗
end
-
+
def test_nothing_changed
a = "James".force_encoding("US-ASCII")
b = a.encode("Shift_JIS")