mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_string.rb: add tests to achieve over 90% test
coverage of string.c. * test/ruby/test_m17n.rb: ditto. * test/ruby/test_symbol.rb: ditto. * test/ruby/test_pack.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
41bf214fd7
commit
b8118e9645
5 changed files with 288 additions and 5 deletions
|
@ -63,6 +63,7 @@ class TestPack < Test::Unit::TestCase
|
|||
assert_equal a, a.pack("P").unpack("P*")
|
||||
assert_equal "a", a.pack("P").unpack("P")[0]
|
||||
assert_equal a, a.pack("P").freeze.unpack("P*")
|
||||
assert_raise(ArgumentError) { (a.pack("P") + "").unpack("P*") }
|
||||
end
|
||||
|
||||
def test_pack_p
|
||||
|
@ -70,6 +71,7 @@ class TestPack < Test::Unit::TestCase
|
|||
assert_equal a, a.pack("p").unpack("p*")
|
||||
assert_equal a[0], a.pack("p").unpack("p")[0]
|
||||
assert_equal a, a.pack("p").freeze.unpack("p*")
|
||||
assert_raise(ArgumentError) { (a.pack("p") + "").unpack("p*") }
|
||||
end
|
||||
|
||||
def test_format_string_modified
|
||||
|
@ -429,4 +431,14 @@ class TestPack < Test::Unit::TestCase
|
|||
assert_equal([0xffffffff], "\217\377\377\377\177".unpack("w"), [0xffffffff])
|
||||
assert_equal([0x100000000], "\220\200\200\200\000".unpack("w"), [0x100000000])
|
||||
end
|
||||
|
||||
def test_modify_under_safe4
|
||||
s = "foo"
|
||||
assert_raise(SecurityError) do
|
||||
Thread.new do
|
||||
$SAFE = 4
|
||||
s.clear
|
||||
end.join
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue