summaryrefslogtreecommitdiffstats
path: root/test/ruby/test_m17n.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-22 00:17:42 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-22 00:17:42 +0000
commitec960a7c4448e0dafbc2745671f2f6358e4aad3e (patch)
tree61ca93118040b40ef34a067d4e4dd83c6a0df993 /test/ruby/test_m17n.rb
parente02f289db7e6e41ba8d3e80cdb3bf3f2a17f832e (diff)
downloadruby-ec960a7c4448e0dafbc2745671f2f6358e4aad3e.tar.gz
ruby-ec960a7c4448e0dafbc2745671f2f6358e4aad3e.tar.xz
ruby-ec960a7c4448e0dafbc2745671f2f6358e4aad3e.zip
* test/ruby/test_m17n.rb: add tests.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n.rb')
-rw-r--r--test/ruby/test_m17n.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index 5ff2a9da7..8a776983e 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -785,6 +785,13 @@ class TestM17N < Test::Unit::TestCase
assert(s("a") < a("\xa1"))
end
+ def test_str_multiply
+ str = "\u3042"
+ assert_equal(true, (str * 0).ascii_only?, "[ruby-dev:33895]")
+ assert_equal(false, (str * 1).ascii_only?)
+ assert_equal(false, (str * 2).ascii_only?
+ end
+
def test_str_aref
assert_equal(a("\xc2"), a("\xc2\xa1")[0])
assert_equal(a("\xa1"), a("\xc2\xa1")[1])
@@ -796,6 +803,11 @@ class TestM17N < Test::Unit::TestCase
assert_equal(nil, s("\xc2\xa1")[2])
assert_equal(u("\xc2\xa1"), u("\xc2\xa1")[0])
assert_equal(nil, u("\xc2\xa1")[1])
+
+ str = "\u3042"
+ assert_equal(true, str[0, 0], "[ruby-dev:33895]")
+ assert_equal(false, str[0, 1])
+ assert_equal(false, str[0...-1])
end
def test_str_aref_len
@@ -1168,5 +1180,5 @@ class TestM17N < Test::Unit::TestCase
s = "\xa1\xa1\x8f".force_encoding("euc-jp")
assert_equal(false, s.valid_encoding?)
assert_equal(true, s.reverse.valid_encoding?)
- end
+ end
end