]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: tests for dns_resource_key_to_string()
authorJames Coglan <james@neighbourhood.ie>
Wed, 29 May 2024 12:42:29 +0000 (13:42 +0100)
committerLuca Boccassi <bluca@debian.org>
Tue, 23 Jul 2024 11:44:35 +0000 (12:44 +0100)
src/resolve/test-dns-rr.c

index bac5c5938ce91c94d6ec7bdcc798ccd479579ac7..28b2a357c4f8d12cdd14f5e5b159e9babb837b9e 100644 (file)
@@ -681,4 +681,19 @@ TEST(dns_resource_key_no_match_soa_parent_domain) {
         ASSERT_FALSE(dns_resource_key_match_soa(key, soa));
 }
 
+/* ================================================================
+ * dns_resource_key_to_string()
+ * ================================================================ */
+
+TEST(dns_resource_key_to_string) {
+        _cleanup_(dns_resource_key_unrefp) DnsResourceKey *key = dns_resource_key_new(DNS_CLASS_IN, DNS_TYPE_CNAME, "www.example.com");
+        char str[256];
+
+        ASSERT_NOT_NULL(key);
+
+        char *ans = dns_resource_key_to_string(key, str, 256);
+        ASSERT_TRUE(ans == str);
+        ASSERT_STREQ(ans, "www.example.com IN CNAME");
+}
+
 DEFINE_TEST_MAIN(LOG_DEBUG);