From 29c0ca58c22b25dbd323d1ba5cdcf6dbdfd505e5 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 15 Mar 2025 00:36:04 +0900 Subject: [PATCH] Test for the crash --- test/socket/test_tcp.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/socket/test_tcp.rb b/test/socket/test_tcp.rb index e6a41f5660..3cc3e18841 100644 --- a/test/socket/test_tcp.rb +++ b/test/socket/test_tcp.rb @@ -18,6 +18,12 @@ class TestSocket_TCPSocket < Test::Unit::TestCase end def test_initialize_failure + assert_raise(Socket::ResolutionError) do + t = TCPSocket.open(nil, nil) + ensure + t&.close + end + # These addresses are chosen from TEST-NET-1, TEST-NET-2, and TEST-NET-3. # [RFC 5737] # They are chosen because probably they are not used as a host address.