summaryrefslogtreecommitdiff
path: root/test/ruby/test_m17n_comb.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-20 13:32:16 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-20 13:32:16 +0000
commit2053b5f4538e157581b8fbf96a30624a2594158c (patch)
tree8d5b386a9583996920f3182ba45dc302e67b0181 /test/ruby/test_m17n_comb.rb
parent44faaf110f45bf5b2591409959f5af30f537007a (diff)
* enc/shift_jis.c (code_to_mbclen): return
ONIGERR_INVALID_CODE_POINT_VALUE if the code is invalid. * enc/shift_jis.c (tr_next): increment character until the code is a valid character. [ruby-dev:45652] [Bug #6450] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n_comb.rb')
-rw-r--r--test/ruby/test_m17n_comb.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb
index 6796aea6b8..d7d3437e08 100644
--- a/test/ruby/test_m17n_comb.rb
+++ b/test/ruby/test_m17n_comb.rb
@@ -1236,6 +1236,20 @@ class TestM17NComb < Test::Unit::TestCase
}
end
+ def test_tr_sjis
+ expected = "\x83}\x83~\x83\x80\x83\x81\x83\x82".force_encoding(Encoding::SJIS)
+ source = "\xCF\xD0\xD1\xD2\xD3".force_encoding(Encoding::SJIS)
+ from = "\xCF-\xD3".force_encoding(Encoding::SJIS)
+ to = "\x83}-\x83\x82".force_encoding(Encoding::SJIS)
+ assert_equal(expected, source.tr(from, to))
+
+ expected = "\x84}\x84~\x84\x80\x84\x81\x84\x82".force_encoding(Encoding::SJIS)
+ source = "\x84M\x84N\x84O\x84P\x84Q".force_encoding(Encoding::SJIS)
+ from = "\x84@-\x84`".force_encoding(Encoding::SJIS)
+ to = "\x84p-\x84\x91".force_encoding(Encoding::SJIS)
+ assert_equal(expected, source.tr(from, to))
+ end
+
def test_tr_s
combination(STRINGS, STRINGS, STRINGS) {|s1, s2, s3|
desc = "#{encdump s1}.tr_s(#{encdump s2}, #{encdump s3})"