summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-11-16 13:09:25 -0800
committerJeremy Evans <code@jeremyevans.net>2021-11-16 19:28:45 -0800
commitd1cbec9b52dd3a2556aa8add4dbef4fd99f43945 (patch)
treeaf100c1b5ec700b5af64e2cbdb3a38a3b4c28e07 /test
parentcbb057e6771b62d006f81d422a6ae566a6e20d43 (diff)
Add a test for bug 18343
This already passes in master, 3.0, and 2.7, but would fail in ruby 2.6 as it segfaults instead of raising an exception. I think it's good to have a test for this to catch possible future regressions.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5128
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_pack.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb
index af45adb2b2..9738f82b7e 100644
--- a/test/ruby/test_pack.rb
+++ b/test/ruby/test_pack.rb
@@ -638,6 +638,14 @@ EXPECTED
end;
end
+ def test_bug_18343
+ bug18343 = '[ruby-core:106096] [Bug #18343]'
+ assert_separately(%W[- #{bug18343}], <<-'end;')
+ bug = ARGV.shift
+ assert_raise(ArgumentError, bug){[0].pack('c', {})}
+ end;
+ end
+
def test_pack_unpack_m0
assert_equal("", [""].pack("m0"))
assert_equal("AA==", ["\0"].pack("m0"))