settings: Parse assigned values in a different context

This allows us to accept characters like = or { without having to use
quoted strings.  And we can also properly warn about unexpected quoted
strings.
This commit is contained in:
Tobias Brunner
2018-05-23 12:01:50 +02:00
parent f8c20fb1c2
commit 740133b12d
2 changed files with 53 additions and 5 deletions
@@ -1109,6 +1109,12 @@ START_TEST(test_valid)
"}\n");
ck_assert(chunk_write(contents, path, 0022, TRUE));
ck_assert(settings->load_files(settings, path, FALSE));
contents = chunk_from_str(
"equals = a setting with = and { character");
ck_assert(chunk_write(contents, path, 0022, TRUE));
ck_assert(settings->load_files(settings, path, FALSE));
verify_string("a setting with = and { character", "equals");
}
END_TEST
@@ -1148,7 +1154,7 @@ START_TEST(test_invalid)
ck_assert(!settings->load_files(settings, path, FALSE));
contents = chunk_from_str(
"only = a single setting = per line");
"\"unexpected\" = string");
ck_assert(chunk_write(contents, path, 0022, TRUE));
ck_assert(!settings->load_files(settings, path, FALSE));
}