diff options
author | luigi1111 <luigi1111w@gmail.com> | 2023-01-11 11:41:11 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2023-01-11 11:41:11 -0500 |
commit | 9489586add5116a48039616140bb7267b16ba7b1 (patch) | |
tree | c8f533e8a7461d97e932834a1cd8e5d9704d5469 /tests | |
parent | Merge pull request #8645 (diff) | |
parent | common: DNSResolver can handle hostnames without dot characters (diff) | |
download | monero-9489586add5116a48039616140bb7267b16ba7b1.tar.xz |
Merge pull request #8648
8687da6 common: DNSResolver can handle hostnames without dot characters (Jeffrey Ryan)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit_tests/dns_resolver.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit_tests/dns_resolver.cpp b/tests/unit_tests/dns_resolver.cpp index a6b733592..d56cbe45b 100644 --- a/tests/unit_tests/dns_resolver.cpp +++ b/tests/unit_tests/dns_resolver.cpp @@ -158,6 +158,17 @@ TEST(DNSResolver, GetTXTRecord) EXPECT_STREQ("donate.getmonero.org", addr.c_str()); } +TEST(DNSResolver, Localhost) +{ + tools::DNSResolver resolver = tools::DNSResolver::create(); + + bool avail, valid; + std::vector<std::string> ips = resolver.get_ipv4("localhost", avail, valid); + + ASSERT_EQ(1, ips.size()); + ASSERT_EQ("127.0.0.1", ips[0]); +} + bool is_equal(const char *s, const std::vector<std::string> &v) { return v.size() == 1 && v[0] == s; } TEST(DNS_PUBLIC, empty) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("").empty()); } |