aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2023-01-11 11:41:56 -0500
committerluigi1111 <luigi1111w@gmail.com>2023-01-11 11:41:56 -0500
commit153819fc4ce8b2af1f4593ba139ee4c86ff310c8 (patch)
tree8fc3fd65ba42e6f7ca09e8972841be48d34d4d49 /tests
parentMerge pull request #8644 (diff)
parentDNSResolver: fix not handling hostnames without dot characters [release] (diff)
downloadmonero-153819fc4ce8b2af1f4593ba139ee4c86ff310c8.tar.xz
Merge pull request #8649
2c24322 DNSResolver: fix not handling hostnames without dot characters [release] (Jeffrey Ryan)
Diffstat (limited to 'tests')
-rw-r--r--tests/unit_tests/dns_resolver.cpp11
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()); }