aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_transcode.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-12 17:13:54 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-12 17:13:54 +0000
commit78f5b54f1b2cdacfc4fab9b37cc71a1d195d9424 (patch)
treea453088e199e488b37e4e1e4c74a2cb73043c1f1 /test/ruby/test_transcode.rb
parent051af24359916791ee09cc6c685d9668e780b61f (diff)
downloadruby-78f5b54f1b2cdacfc4fab9b37cc71a1d195d9424.tar.gz
* enc/trans/utf8_mac.trans (buf_apply): fix for patterns
whose result is 2 bytes. [ruby-core:30751] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_transcode.rb')
-rw-r--r--test/ruby/test_transcode.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb
index 6349d3b29b..1b15a5b556 100644
--- a/test/ruby/test_transcode.rb
+++ b/test/ruby/test_transcode.rb
@@ -1912,6 +1912,16 @@ class TestTranscode < Test::Unit::TestCase
assert_equal(Encoding::Shift_JIS, b.encoding)
end
+ def test_utf8_mac
+ assert_equal("\u{fb4d}", "\u05DB\u05BF".encode("UTF-8", "UTF8-MAC"))
+ assert_equal("\u{1ff7}", "\u03C9\u0345\u0342".encode("UTF-8", "UTF8-MAC"))
+
+ assert_equal("\u05DB\u05BF", "\u{fb4d}".encode("UTF8-MAC").force_encoding("UTF-8"))
+ assert_equal("\u03C9\u0345\u0342", "\u{1ff7}".encode("UTF8-MAC").force_encoding("UTF-8"))
+
+ check_both_ways("\u{e9 74 e8}", "e\u0301te\u0300", 'UTF8-MAC')
+ end
+
def test_fallback
assert_equal("\u3042".encode("EUC-JP"), "\u{20000}".encode("EUC-JP",
fallback: {"\u{20000}" => "\u3042".encode("EUC-JP")}))