aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_m17n.rb11
-rw-r--r--test/ruby/test_regexp.rb7
2 files changed, 13 insertions, 5 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index 069554a127..7a9e24f4a1 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -810,6 +810,17 @@ class TestM17N < Test::Unit::TestCase
assert_equal(false, str[0..-1].ascii_only?)
end
+ def test_utf8str_aref
+ s = "abcdefghijklmnopqrstuvwxyz\u{3042 3044 3046 3048 304A}"
+ assert_equal("a", s[0])
+ assert_equal("h", s[7])
+ assert_equal("i", s[8])
+ assert_equal("j", s[9])
+ assert_equal("\u{3044}", s[27])
+ assert_equal("\u{3046}", s[28])
+ assert_equal("\u{3048}", s[29])
+ end
+
def test_str_aref_len
assert_equal(a("\xa1"), a("\xc2\xa1\xc2\xa2\xc2\xa3")[1, 1])
assert_equal(a("\xa1\xc2"), a("\xc2\xa1\xc2\xa2\xc2\xa3")[1, 2])
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 29783d4153..17fe9fa45f 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -123,6 +123,8 @@ class TestRegexp < Test::Unit::TestCase
r = /./
m = r.match("a")
assert_equal(r, m.regexp)
+ re = /foo/
+ assert_equal(re, re.match("foo").regexp)
end
def test_source
@@ -188,11 +190,6 @@ class TestRegexp < Test::Unit::TestCase
assert_equal(/foo/, m.dup.regexp)
end
- def test_match_regexp
- re = /foo/
- assert_equal(re, re.match("foo").regexp)
- end
-
def test_match_size
m = /(.)(.)(\d+)(\d)/.match("THX1138.")
assert_equal(5, m.size)