Skip to content
This repository has been archived by the owner on Aug 6, 2020. It is now read-only.

Commit

Permalink
test: add testcase for issue systemd#12883
Browse files Browse the repository at this point in the history
(cherry picked from commit 3d5d346)
(cherry picked from commit 572385e)
  • Loading branch information
yuwata authored and Mic92 committed Jun 29, 2019
1 parent bcbaa8d commit aa4c4d3
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/test/test-conf-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ static const char* const config_file[] = {
"setting1=2\n"
"setting1=1\n", /* repeated settings */

"[Section]\n"
"[Section]\n"
"setting1=1\n"
"setting1=2\\\n"
" \n" /* empty line breaks continuation */
"setting1=1\n", /* repeated settings */

"[Section]\n"
"setting1=1\\\n" /* normal continuation */
"2\\\n"
Expand Down Expand Up @@ -330,32 +337,32 @@ static void test_config_parse(unsigned i, const char *s) {
CONFIG_PARSE_WARN, NULL);

switch (i) {
case 0 ... 3:
case 0 ... 4:
assert_se(r == 0);
assert_se(streq(setting1, "1"));
break;

case 4 ... 9:
case 5 ... 10:
assert_se(r == 0);
assert_se(streq(setting1, "1 2 3"));
break;

case 10:
case 11:
assert_se(r == 0);
assert_se(streq(setting1, "1\\\\ \\\\2"));
break;

case 11:
case 12:
assert_se(r == 0);
assert_se(streq(setting1, x1000("ABCD")));
break;

case 12 ... 13:
case 13 ... 14:
assert_se(r == 0);
assert_se(streq(setting1, x1000("ABCD") " foobar"));
break;

case 14 ... 15:
case 15 ... 16:
assert_se(r == -ENOBUFS);
assert_se(setting1 == NULL);
break;
Expand Down

0 comments on commit aa4c4d3

Please sign in to comment.