]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/test/test-conf-parser.c
Merge pull request #11827 from keszybz/pkgconfig-variables
[thirdparty/systemd.git] / src / test / test-conf-parser.c
index 497becff731c62df97781fde9c1a3b5a1affdccb..1738938fce61230b15fbcf9b1c975415878d6500 100644 (file)
@@ -2,12 +2,12 @@
 
 #include "conf-parser.h"
 #include "fd-util.h"
-#include "fileio.h"
 #include "fs-util.h"
 #include "log.h"
 #include "macro.h"
 #include "string-util.h"
 #include "strv.h"
+#include "tmpfile-util.h"
 #include "util.h"
 
 static void test_config_parse_path_one(const char *rvalue, const char *expected) {
@@ -247,6 +247,18 @@ static const char* const config_file[] = {
         "2\\\n"
         "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"
@@ -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;