mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9c09689301
commit
f23bc6b2b5
1 changed files with 37 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue