Skip to content

Commit aaa158e

Browse files
committed
Add specs for consuming null byte.
1 parent 231f53f commit aaa158e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

spec/ruby/core/string/unpack/z_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,9 @@
2020
["\x00a\x00 bc \x00", ["", "c"]]
2121
].should be_computed_by(:unpack, "Z5Z")
2222
end
23+
24+
it "does not advance past the null byte when given a 'Z' format specifier" do
25+
"a\x00\x0f".unpack('Zxc').should == ['a', 15]
26+
"a\x00\x0f".unpack('Zcc').should == ['a', 0, 15]
27+
end
2328
end

0 commit comments

Comments
 (0)