diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-11-06 13:22:09 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-11-08 18:09:04 +0900 |
commit | 9adbfeb38ac101d6f73a033bb120d63513ffb240 (patch) | |
tree | 7a6a9a6c8ebb0187e156feb1eacd72e666f31be3 /src/test | |
parent | 8d2411f69348a081419c2fb7cddbe1970cf3eac5 (diff) | |
download | systemd-9adbfeb38ac101d6f73a033bb120d63513ffb240.tar.gz systemd-9adbfeb38ac101d6f73a033bb120d63513ffb240.tar.bz2 systemd-9adbfeb38ac101d6f73a033bb120d63513ffb240.zip |
conf-parser: ignore trailing back-slash in comment
Fixes #10598.
Diffstat (limited to 'src/test')
-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 91f1d9a386..368e02cb33 100644 --- a/src/test/test-conf-parser.c +++ b/src/test/test-conf-parser.c @@ -275,6 +275,18 @@ static const char* const config_file[] = { "3\n", "[Section]\n" + "#hogehoge\\\n" /* continuation is ignored in comment */ + "setting1=1\\\n" /* normal continuation */ + "2\\\n" + "3\n", + + "[Section]\n" + "setting1=1\\\n" /* normal continuation */ + "#hogehoge\\\n" /* commented out line in continuation is ignored */ + "2\\\n" + "3\n", + + "[Section]\n" "setting1=1\\\n" /* continuation with extra trailing backslash at the end */ "2\\\n" "3\\\n", @@ -350,27 +362,27 @@ static void test_config_parse(unsigned i, const char *s) { assert_se(streq(setting1, "1")); break; - case 4 ... 5: + case 4 ... 7: assert_se(r == 0); assert_se(streq(setting1, "1 2 3")); break; - case 6: + case 8: assert_se(r == 0); assert_se(streq(setting1, "1\\\\ \\\\2")); break; - case 7: + case 9: assert_se(r == 0); assert_se(streq(setting1, x1000("ABCD"))); break; - case 8 ... 9: + case 10 ... 11: assert_se(r == 0); assert_se(streq(setting1, x1000("ABCD") " foobar")); break; - case 10 ... 11: + case 12 ... 13: assert_se(r == -ENOBUFS); assert_se(setting1 == NULL); break; |