tests/test_properties.c

changeset 1683
e5399c60ae96
parent 1669
d416628d6c7d
--- a/tests/test_properties.c	Tue Dec 30 21:48:07 2025 +0100
+++ b/tests/test_properties.c	Tue Dec 30 22:13:44 2025 +0100
@@ -517,6 +517,30 @@
     cxPropertiesDestroy(&prop);
 }
 
+CX_TEST(test_properties_next_alternative_delimiter) {
+    CxProperties prop;
+    CxPropertiesConfig alt_config = {0};
+    alt_config.delimiter = ':';
+    cxPropertiesInit(&prop, alt_config);
+    
+    cxstring key;
+    cxstring value;
+    CxPropertiesStatus result;
+    
+    CX_TEST_DO {
+        CX_TEST_ASSERT(0 == cxPropertiesFill(&prop, "no_delimiter = value\n"));
+        result = cxPropertiesNext(&prop, &key,  &value);
+        CX_TEST_ASSERT(result == CX_PROPERTIES_INVALID_MISSING_DELIMITER);
+        cxPropertiesReset(&prop);
+        CX_TEST_ASSERT(0 == cxPropertiesFill(&prop, "correct : value\n"));
+        result = cxPropertiesNext(&prop, &key,  &value);
+        CX_TEST_ASSERT(result == CX_PROPERTIES_NO_ERROR);
+        CX_TEST_ASSERT(!cx_strcmp(key, "correct"));
+        CX_TEST_ASSERT(!cx_strcmp(value, "value"));
+    }
+    cxPropertiesDestroy(&prop);
+}
+
 static FILE *cx_opentmp(char *tpl) {
 #ifdef WITH_MKSTEMP
     strcpy(tpl, "ucxtestXXXXXX");
@@ -865,6 +889,7 @@
     cx_test_register(suite, test_properties_next_starts_with_newlines);
     cx_test_register(suite, test_properties_next_line_continuation);
     cx_test_register(suite, test_properties_next_line_continuation_part);
+    cx_test_register(suite, test_properties_next_alternative_delimiter);
     cx_test_register(suite, test_properties_load);
     cx_test_register(suite, test_properties_load_empty_file);
     cx_test_register(suite, test_properties_load_only_comments);

mercurial