From 2f6a8baac6a84935cef1f10adbba2f47df4a2346 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Fri, 6 Dec 2019 15:56:14 +0900 Subject: [PATCH] Test interfaces include localhost When interfaces do not include localhost, some other tests may fail. --- test/socket/test_socket.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb index 3b2ea51b94..f1ec927c4c 100644 --- a/test/socket/test_socket.rb +++ b/test/socket/test_socket.rb @@ -121,6 +121,15 @@ class TestSocket < Test::Unit::TestCase } end + def test_ip_address_list_include_localhost + begin + list = Socket.ip_address_list + rescue NotImplementedError + return + end + assert_includes list.map(&:ip_address), Addrinfo.tcp("localhost", 0).ip_address + end + def test_tcp TCPServer.open(0) {|serv| addr = serv.connect_address