From: Timo Sirainen Date: Fri, 19 May 2023 13:04:22 +0000 (+0300) Subject: lib-settings: test-settings-parser - Parse settings with keyvalue instead of line X-Git-Tag: 2.4.0~1997 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8f3ca3fb851687d5403098b8a6010ac5efe2c4c;p=thirdparty%2Fdovecot%2Fcore.git lib-settings: test-settings-parser - Parse settings with keyvalue instead of line --- diff --git a/src/lib-settings/test-settings-parser.c b/src/lib-settings/test-settings-parser.c index c487cc5621..c99346a659 100644 --- a/src/lib-settings/test-settings-parser.c +++ b/src/lib-settings/test-settings-parser.c @@ -10,20 +10,20 @@ static const char *const test_settings_blobs[] = { /* Blob 0 */ - "bool_true=yes", - "bool_false=no", - "uint=15", - "uint_oct=0700", - "secs=5s", - "msecs=5ms", - "size=1k", - "port=2205", - "str=test string", - "expand_str=test %{string}", - "strlist=", - "strlist/x=a", - "strlist/y=b", - "strlist/z=c", + "bool_true", "yes", + "bool_false", "no", + "uint", "15", + "uint_oct", "0700", + "secs", "5s", + "msecs", "5ms", + "size", "1k", + "port", "2205", + "str", "test string", + "expand_str", "test %{string}", + "strlist", "", + "strlist/x", "a", + "strlist/y", "b", + "strlist/z", "c", }; static void test_settings_parser(void) @@ -85,12 +85,13 @@ static void test_settings_parser(void) settings_parser_init(pool, &root, 0); const char *error = NULL; int ret = 1; - for (unsigned int i = 0; i < N_ELEMENTS(test_settings_blobs); i++) { - ret = settings_parse_line(ctx, test_settings_blobs[i]); + for (unsigned int i = 0; i < N_ELEMENTS(test_settings_blobs); i += 2) { + ret = settings_parse_keyvalue(ctx, test_settings_blobs[i], + test_settings_blobs[i+1]); test_assert_idx(ret == 1, i); } if (ret < 0) - i_error("settings_parse_line() failed: %s", + i_error("settings_parse_keyvalue() failed: %s", settings_parser_get_error(ctx)); test_assert(settings_parser_check(ctx, pool, NULL, NULL));