diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-01 13:20:47 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-01 13:20:47 +0000 |
commit | b6e137e93c5fe62f3f6dc1a0112a6c067d456f9b (patch) | |
tree | f7112b488569865bde733465608172bc79d620c2 /test/ruby | |
parent | 0dd9c302d9374f52abb09662b554e4ee95011444 (diff) | |
download | ruby-b6e137e93c5fe62f3f6dc1a0112a6c067d456f9b.tar.gz |
Remove `offset:` from `Array#pack`
* pack.c (pack_pack): can use `@` instead of `offset:`.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_pack.rb | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb index 415dc78e60..8ecfbc0913 100644 --- a/test/ruby/test_pack.rb +++ b/test/ruby/test_pack.rb @@ -816,18 +816,9 @@ EXPECTED def test_pack_with_buffer buf = String.new(capacity: 100) - assert_raise_with_message(ArgumentError, /without buffer/) { - [0xDEAD_BEEF].pack('N', offset: 10) - } - assert_raise_with_message(ArgumentError, /too small/) { - [0xDEAD_BEEF].pack('N', buffer: buf, offset: 200) - } assert_raise_with_message(RuntimeError, /frozen/) { [0xDEAD_BEEF].pack('N', buffer: 'foo'.freeze) } - assert_raise_with_message(TypeError, /into Integer/) { - [0xDEAD_BEEF].pack('N', buffer: buf, offset: '10') - } assert_raise_with_message(TypeError, /must be String/) { [0xDEAD_BEEF].pack('N', buffer: Object.new) } @@ -837,11 +828,11 @@ EXPECTED [0xDEAD_BEEF].pack('N', buffer: buf) assert_equal "\xDE\xAD\xBE\xEF", buf - [0xBABE_F00D].pack('N', buffer: buf, offset: 4) + [0xBABE_F00D].pack('@4N', buffer: buf) assert_equal "\xDE\xAD\xBE\xEF\xBA\xBE\xF0\x0D", buf assert_equal addr, [buf].pack('p') - [0xBAAD_FACE].pack('N', buffer: buf, offset: 10) + [0xBAAD_FACE].pack('@10N', buffer: buf) assert_equal "\xDE\xAD\xBE\xEF\xBA\xBE\xF0\x0D\0\0\xBA\xAD\xFA\xCE", buf assert_equal addr, [buf].pack('p') |