aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_pack.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-01 13:20:47 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-01 13:20:47 +0000
commitebe9c914f071c6ad6388dbd9e7b8789f2bc6baf4 (patch)
treef7112b488569865bde733465608172bc79d620c2 /test/ruby/test_pack.rb
parent001b9a1ef694d634549a34480205ecc1d98d9026 (diff)
downloadruby-ebe9c914f071c6ad6388dbd9e7b8789f2bc6baf4.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/test_pack.rb')
-rw-r--r--test/ruby/test_pack.rb13
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')