diff options
Diffstat (limited to 'test/resolv/test_mdns.rb')
-rw-r--r-- | test/resolv/test_mdns.rb | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/test/resolv/test_mdns.rb b/test/resolv/test_mdns.rb index 8e401883f1..9c17f9b219 100644 --- a/test/resolv/test_mdns.rb +++ b/test/resolv/test_mdns.rb @@ -3,20 +3,24 @@ require 'test/unit' require 'resolv' class TestResolvMDNS < Test::Unit::TestCase - def setup - end - def test_mdns_each_address - begin - mdns = Resolv::MDNS.new - mdns.each_resource '_http._tcp.local', Resolv::DNS::Resource::IN::PTR do |r| - srv = mdns.getresource r.name, Resolv::DNS::Resource::IN::SRV - mdns.each_address(srv.target) do |result| - assert_not_nil(result) - end + mdns = Resolv::MDNS.new + def mdns.each_resource(name, typeclass) + if typeclass == Resolv::DNS::Resource::IN::A + yield typeclass.new("127.0.0.1") + else + yield typeclass.new("::1") + end + end + [ + ["example.com", []], + ["foo.local", ["127.0.0.1"]], + ].each do |name, expect| + results = [] + mdns.each_address(name) do |result| + results << result.to_s end - rescue Errno::EADDRNOTAVAIL - # Handle Raspberry Pi environment. + assert_equal expect, results, "GH-1484" end end end |