diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-01-08 06:12:22 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-01-08 06:12:22 +0100 |
commit | ff650ffe348b3a22f2fe4ef6b579526d9e55a6ee (patch) | |
tree | 05aaba2b3329ca5a96ee90a57d842e452f5a4412 | |
parent | conf-parser: accept whitespaces before comments (diff) | |
download | systemd-ff650ffe348b3a22f2fe4ef6b579526d9e55a6ee.tar.xz systemd-ff650ffe348b3a22f2fe4ef6b579526d9e55a6ee.zip |
test: add testcases for the lines prefixed with whitespaces
-rw-r--r-- | src/test/test-conf-parser.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/test/test-conf-parser.c b/src/test/test-conf-parser.c index 2921338f62..1738938fce 100644 --- a/src/test/test-conf-parser.c +++ b/src/test/test-conf-parser.c @@ -248,6 +248,18 @@ static const char* const config_file[] = { "3\n", "[Section]\n" + " #hogehoge\\\n" /* whitespaces before comments */ + " setting1=1\\\n" /* whitespaces before key */ + "2\\\n" + "3\n", + + "[Section]\n" + " setting1=1\\\n" /* whitespaces before key */ + " #hogehoge\\\n" /* commented out line prefixed with whitespaces in continuation */ + "2\\\n" + "3\n", + + "[Section]\n" "setting1=1\\\n" /* continuation with extra trailing backslash at the end */ "2\\\n" "3\\\n", @@ -323,27 +335,27 @@ static void test_config_parse(unsigned i, const char *s) { assert_se(streq(setting1, "1")); break; - case 4 ... 7: + case 4 ... 9: assert_se(r == 0); assert_se(streq(setting1, "1 2 3")); break; - case 8: + case 10: assert_se(r == 0); assert_se(streq(setting1, "1\\\\ \\\\2")); break; - case 9: + case 11: assert_se(r == 0); assert_se(streq(setting1, x1000("ABCD"))); break; - case 10 ... 11: + case 12 ... 13: assert_se(r == 0); assert_se(streq(setting1, x1000("ABCD") " foobar")); break; - case 12 ... 13: + case 14 ... 15: assert_se(r == -ENOBUFS); assert_se(setting1 == NULL); break; |