]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add test for `cfg_map_findclause()`
authorColin Vidal <colin@isc.org>
Tue, 19 May 2026 13:12:36 +0000 (15:12 +0200)
committerColin Vidal <colin@isc.org>
Thu, 21 May 2026 14:04:01 +0000 (16:04 +0200)
Add a test for `cfg_map_findclause()` ensuring its correct behaviour
(returning NULL) if a clause does not exists.

tests/isccfg/parser_test.c

index 25d46ff7e7f5bdcb389e574909cc63d3033fa4f7..4e30da35a6de58890cf63460c6f6067bcfb0cbe6 100644 (file)
@@ -303,6 +303,18 @@ view \"_bind\" chaos {\n\
        cfg_obj_detach(&clone);
 }
 
+static const cfg_clausedef_t *const empty_clausesets[] = { NULL };
+
+static cfg_type_t cfg_type_empty_map = {
+       "empty_map", NULL, NULL, NULL, &cfg_rep_map, &empty_clausesets,
+};
+
+ISC_RUN_TEST_IMPL(cfg_map_findclause_empty) {
+       const cfg_clausedef_t *result = cfg_map_findclause(&cfg_type_empty_map,
+                                                          "anything");
+       assert_null(result);
+}
+
 ISC_TEST_LIST_START
 
 ISC_TEST_ENTRY(addzoneconf)
@@ -310,6 +322,7 @@ ISC_TEST_ENTRY(parse_buffer)
 ISC_TEST_ENTRY(cfg_map_firstclause)
 ISC_TEST_ENTRY(cfg_map_nextclause)
 ISC_TEST_ENTRY(cfg_clone_copy)
+ISC_TEST_ENTRY(cfg_map_findclause_empty)
 
 ISC_TEST_LIST_END