From f23bc6b2b5228f39a55d798079fe0db514695ba6 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 24 Dec 2007 11:36:48 +0000 Subject: add tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_m17n.rb | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index de66ab3516..da765312cb 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 -- cgit v1.2.3