diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/resolv/test_dns.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/resolv/test_dns.rb b/test/resolv/test_dns.rb index 0ab59665a3..9a9c33ea84 100644 --- a/test/resolv/test_dns.rb +++ b/test/resolv/test_dns.rb @@ -104,4 +104,18 @@ class TestResolvDNS < Test::Unit::TestCase end } end + + def test_no_server + u = UDPSocket.new + u.bind("127.0.0.1", 0) + _, port, _, host = u.addr + u.close + # A rase condition here. + # Another program may use the port. + # But no way to prevent it. + Resolv::DNS.open(:nameserver_port => [[host, port]]) {|dns| + assert_equal([], dns.getresources("test-no-server.example.org", Resolv::DNS::Resource::IN::A)) + } + end + end |