mirror of
https://github.com/ruby/ruby.git
synced 2025-09-19 10:33:58 +02:00
* enc/emacs_mule.c (emacsmule_islead): 7bit range is also leading
byte. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
46142e472f
commit
b4be48e88d
3 changed files with 23 additions and 12 deletions
|
@ -1106,17 +1106,11 @@ class TestM17N < Test::Unit::TestCase
|
|||
s1 = s("\x81\x40")
|
||||
s2 = "@"
|
||||
assert_equal(false, s1.end_with?(s2), "#{encdump s1}.end_with?(#{encdump s2})")
|
||||
s1orig = "\u3042\u3044"
|
||||
s2orig = "\u3044"
|
||||
Encoding.list.each do |enc|
|
||||
next if enc.dummy?
|
||||
begin
|
||||
s1 = s1orig.encode(enc)
|
||||
s2 = s2orig.encode(enc)
|
||||
rescue
|
||||
else
|
||||
assert_equal(true, s1.end_with?(s2), "#{encdump s1}.end_with?(#{encdump s2})")
|
||||
end
|
||||
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
|
||||
|
||||
|
@ -1152,6 +1146,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
|
||||
|
@ -1397,4 +1395,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue