Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spec for String#unpack raising ArgumentError on unknown directive #1218

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions core/string/unpack/shared/basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
d.should_receive(:to_str).and_return("a"+unpack_format)
"abc".unpack(d).should be_an_instance_of(Array)
end

ruby_version_is "3.3" do
# https://bugs.ruby-lang.org/issues/19150
it 'raise ArgumentError when a directive is unknown' do
-> { "abcdefgh".unpack("a R" + unpack_format) }.should raise_error(ArgumentError)
-> { "abcdefgh".unpack("a 0" + unpack_format) }.should raise_error(ArgumentError)
-> { "abcdefgh".unpack("a :" + unpack_format) }.should raise_error(ArgumentError)
end
end
end

describe :string_unpack_no_platform, shared: true do
Expand Down