diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-03-28 13:38:26 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-03-28 13:38:26 +0000 |
commit | ed08646487af3a802ac0c31d37626ee8a00388d3 (patch) | |
tree | a3119bc5af68b6dc73c86eb40f6317b982856123 /test | |
parent | b243ccc46e64b723538db99a8f66f5aaa06f6d56 (diff) |
merges r30727 and r30731 from trunk into ruby_1_9_2.
--
* enc/emacs_mule.c (emacsmule_islead): fix inverse condition.
--
* enc/emacs_mule.c (emacsmule_islead): 7bit range is also leading
byte.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_m17n.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 3a71bd9bf0..81547fb800 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1074,6 +1074,12 @@ class TestM17N < Test::Unit::TestCase s1 = s("\x81\x40") s2 = "@" assert_equal(false, s1.end_with?(s2), "#{encdump s1}.end_with?(#{encdump s2})") + each_encoding("\u3042\u3044", "\u3044") do |_s1, _s2| + assert_equal(true, _s1.end_with?(_s2), "#{encdump _s1}.end_with?(#{encdump _s2})") + end + each_encoding("\u3042a\u3044", "a\u3044") do |_s1, _s2| + assert_equal(true, _s1.end_with?(_s2), "#{encdump _s1}.end_with?(#{encdump _s2})") + end end def test_each_line @@ -1108,6 +1114,10 @@ class TestM17N < Test::Unit::TestCase assert_equal(e("\xa1\xa2\xa1\xa3").split(//), [e("\xa1\xa2"), e("\xa1\xa3")], '[ruby-dev:32452]') + + each_encoding("abc,def", ",", "abc", "def") do |str, sep, *expected| + assert_equal(expected, str.split(sep, -1)) + end end def test_nonascii_method_name @@ -1353,4 +1363,12 @@ class TestM17N < Test::Unit::TestCase def test_combchar_codepoint assert_equal([0x30BB, 0x309A], "\u30BB\u309A".codepoints.to_a) end + + def each_encoding(*strings) + Encoding.list.each do |enc| + next if enc.dummy? + strs = strings.map {|s| s.encode(enc)} rescue next + yield *strs + end + end end |