Skip to content

Commit

Permalink
IPv6 addresses formatting: added test to ensure what this is address,…
Browse files Browse the repository at this point in the history
… not hostname
  • Loading branch information
denizzzka committed Nov 19, 2024
1 parent 5a738b1 commit 8bac4f2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/vibe/core/net.d
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,10 @@ struct NetworkAddress {
unittest {
void test(string ip, string expected = null) {
if(expected is null) expected = ip;
auto res = () @trusted { return resolveHost(ip, AF_UNSPEC, false); } ().toAddressString();
auto w_dns = () @trusted { return resolveHost(ip, AF_UNSPEC, true); } ();
auto no_dns = () @trusted { return resolveHost(ip, AF_UNSPEC, false); } ();
assert(no_dns == w_dns);
auto res = no_dns.toAddressString();
assert(res == expected,
"IP "~ip~" yielded wrong string representation: "~res~", expected: "~expected);
}
Expand Down

0 comments on commit 8bac4f2

Please sign in to comment.