# HG changeset patch # User Mike Becker # Date 1766659670 -3600 # Node ID d416628d6c7d8a7f26f8e5fe335c6941d58bd984 # Parent 3ffdfe1776b4cdbc02c01f260327409d73d659fb add test_properties_next_starts_with_newlines() just a precaution diff -r 3ffdfe1776b4 -r d416628d6c7d tests/test_properties.c --- 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);