mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* pack.c (num2i32): pack should not raise RangeError.
[ruby-dev:22654] * pack.c (pack_pack): do not auto convert nil to zero. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
edddc36970
commit
7df46a4493
5 changed files with 64 additions and 103 deletions
|
@ -27,6 +27,10 @@ class TestPack < Test::Unit::TestCase
|
|||
assert_equal "\377\377\377\376", [4294967294].pack('N')
|
||||
assert_equal "\377\377\377\377", [4294967295].pack('N')
|
||||
|
||||
assert_equal "\200\000\000\000", [2**31].pack('N')
|
||||
assert_equal "\177\377\377\377", [-2**31-1].pack('N')
|
||||
assert_equal "\377\377\377\377", [-1].pack('N')
|
||||
|
||||
assert_equal "\000\000\000\001\000\000\000\001", [1,1].pack('N*')
|
||||
assert_equal "\000\000\000\001\000\000\000\001\000\000\000\001", [1,1,1].pack('N*')
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue