summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-24 11:36:48 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-24 11:36:48 +0000
commitf23bc6b2b5228f39a55d798079fe0db514695ba6 (patch)
tree76314b9658d021181107fa694fb038259955b44b
parent9c09689301fd6bddbb5a9397a6854fef35a224ae (diff)
add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_m17n.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index de66ab35168..da765312cb7 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -657,6 +657,16 @@ class TestM17N < Test::Unit::TestCase
assert_nothing_raised { eval(u(%{/\\u{6666}#{}\\xc2\\xa0/})) }
end
+ def test_str_allocate
+ s = String.allocate
+ assert_equal(Encoding::ASCII_8BIT, s.encoding)
+ end
+
+ def test_str_String
+ s = String(10)
+ assert_equal(Encoding::ASCII_8BIT, s.encoding)
+ end
+
def test_str_new
STRINGS.each {|s|
t = String.new(s)
@@ -1873,4 +1883,31 @@ class TestM17N < Test::Unit::TestCase
assert_equal(e("\xc2\xa1"), me.name)
assert_equal(u("\xc2\xa1"), mu.name)
end
+
+ def test_symbol
+ s1 = "\xc2\xa1".force_encoding("euc-jp").intern
+ s2 = "\xc2\xa1".force_encoding("utf-8").intern
+ assert_not_equal(s1, s2)
+ end
+
+ def test_chr
+ 0.upto(255) {|b|
+ assert_equal([b].pack("C"), b.chr)
+ }
+ end
+
+ def test_marshal
+ STRINGS.each {|s|
+ m = Marshal.dump(s)
+ t = Marshal.load(m)
+ assert_equal(s, t)
+ }
+ end
+
+ def test_env
+ ENV.each {|k, v|
+ assert_equal(Encoding::ASCII_8BIT, k.encoding)
+ assert_equal(Encoding::ASCII_8BIT, v.encoding)
+ }
+ end
end