diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-24 11:36:48 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-24 11:36:48 +0000 |
| commit | 2664ad5b4351363157ea50b74482b6072dca23eb (patch) | |
| tree | 76314b9658d021181107fa694fb038259955b44b /test/ruby | |
| parent | b63a7b160e3bdd6ae3589060864098e9a3353fe7 (diff) | |
| download | ruby-2664ad5b4351363157ea50b74482b6072dca23eb.tar.gz ruby-2664ad5b4351363157ea50b74482b6072dca23eb.tar.xz ruby-2664ad5b4351363157ea50b74482b6072dca23eb.zip | |
add tests.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_m17n.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index de66ab351..da765312c 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 |
