We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
TestSocket_TCPSocket#test_initialize_failure
1 parent 29c0ca5 commit 35920f7Copy full SHA for 35920f7
test/socket/test_tcp.rb
@@ -49,16 +49,14 @@ def test_initialize_failure
49
server_addr = '127.0.0.1'
50
server_port = 80
51
52
- begin
+ e = assert_raise_kind_of(SystemCallError) do
53
# Since client_addr is not an IP address of this host,
54
# bind() in TCPSocket.new should fail as EADDRNOTAVAIL.
55
t = TCPSocket.new(server_addr, server_port, client_addr, client_port)
56
- flunk "expected SystemCallError"
57
- rescue SystemCallError => e
58
- assert_match "for \"#{client_addr}\" port #{client_port}", e.message
+ ensure
+ t&.close
59
end
60
- ensure
61
- t.close if t && !t.closed?
+ assert_include e.message, "for \"#{client_addr}\" port #{client_port}"
62
63
64
def test_initialize_resolv_timeout
0 commit comments