[前][次][番号順一覧][スレッド一覧]

ruby-changes:69770

From: Jeremy <ko1@a...>
Date: Wed, 17 Nov 2021 12:29:11 +0900 (JST)
Subject: [ruby-changes:69770] d1cbec9b52 (master): Add a test for bug 18343

https://git.ruby-lang.org/ruby.git/commit/?id=d1cbec9b52

From d1cbec9b52dd3a2556aa8add4dbef4fd99f43945 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Tue, 16 Nov 2021 13:09:25 -0800
Subject: 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.
---
 test/ruby/test_pack.rb | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb
index af45adb2b23..9738f82b7e2 100644
--- a/test/ruby/test_pack.rb
+++ b/test/ruby/test_pack.rb
@@ -638,6 +638,14 @@ EXPECTED https://github.com/ruby/ruby/blob/trunk/test/ruby/test_pack.rb#L638
     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"))
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]