--- a/tests/test_properties.c Thu Dec 25 11:39:26 2025 +0100 +++ b/tests/test_properties.c Thu Dec 25 11:47:50 2025 +0100 @@ -384,6 +384,32 @@ free(long_value); } +CX_TEST(test_properties_next_starts_with_newlines) { + const char *str1 = "key1 = value1"; + const char *str2 = "\nkey2 = value2\n"; + + CxProperties prop; + cxPropertiesInitDefault(&prop); + + cxstring key; + cxstring value; + + CX_TEST_DO { + CX_TEST_ASSERT(0 == cxPropertiesFill(&prop, str1)); + CX_TEST_ASSERT(cxPropertiesNext(&prop, &key, &value) == CX_PROPERTIES_INCOMPLETE_DATA); + CX_TEST_ASSERT(0 == cxPropertiesFill(&prop, str2)); + CX_TEST_ASSERT(cxPropertiesNext(&prop, &key, &value) == CX_PROPERTIES_NO_ERROR); + CX_TEST_ASSERT(!cx_strcmp(key, "key1")); + CX_TEST_ASSERT(!cx_strcmp(value, "value1")); + CX_TEST_ASSERT(cxPropertiesNext(&prop, &key, &value) == CX_PROPERTIES_NO_ERROR); + CX_TEST_ASSERT(!cx_strcmp(key, "key2")); + CX_TEST_ASSERT(!cx_strcmp(value, "value2")); + CX_TEST_ASSERT(cxPropertiesNext(&prop, &key, &value) == CX_PROPERTIES_NO_DATA); + } + + cxPropertiesDestroy(&prop); +} + CX_TEST(test_properties_next_line_continuation) { const char *str = "key1 = multiline \\\nvalue\n" @@ -836,6 +862,7 @@ cx_test_register(suite, test_properties_next_multi); cx_test_register(suite, test_properties_next_part); cx_test_register(suite, test_properties_next_long_lines); + 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_load);