1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05: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:
nobu 2011-01-30 06:13:25 +00:00
parent 46142e472f
commit b4be48e88d
3 changed files with 23 additions and 12 deletions

View file

@ -1,3 +1,8 @@
Sun Jan 30 15:13:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* enc/emacs_mule.c (emacsmule_islead): 7bit range is also leading
byte.
Sun Jan 30 13:03:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* hash.c (rb_hash_fetch_m): use useful message for longer key, not a

View file

@ -30,7 +30,7 @@
#include "regint.h"
#define emacsmule_islead(c) ((UChar )((c) - 0x81) < 0x9e - 0x81)
#define emacsmule_islead(c) ((UChar )(c) < 0x9e)
/*
CHARACTER := ASCII_CHAR | MULTIBYTE_CHAR

View file

@ -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