summaryrefslogtreecommitdiff
path: root/src/test-env-replace.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-01-05 16:06:35 +0100
committerLennart Poettering <lennart@poettering.net>2011-01-05 16:06:35 +0100
commit5f7c426e2a7f72c473f98be9978d243db79d8910 (patch)
treebe5023d062e91526d7394d6624dc0e2d44d6cd5c /src/test-env-replace.c
parent38752828029e72e72d80519bb6c67354782ddb72 (diff)
fragment: properly handle quotes in assignments in EnvironmentFile= files
Diffstat (limited to 'src/test-env-replace.c')
-rw-r--r--src/test-env-replace.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/test-env-replace.c b/src/test-env-replace.c
index e8c9dbf736..37dd7ff590 100644
--- a/src/test-env-replace.c
+++ b/src/test-env-replace.c
@@ -47,7 +47,7 @@ int main(int argc, char *argv[]) {
NULL
};
- char **i, **r;
+ char **i, **r, *t;
r = replace_env_argv((char**) line, (char**) env);
@@ -56,4 +56,45 @@ int main(int argc, char *argv[]) {
strv_free(r);
+ t = normalize_env_assignment("foo=bar");
+ printf("%s\n", t);
+ free(t);
+
+ t = normalize_env_assignment("=bar");
+ printf("%s\n", t);
+ free(t);
+
+ t = normalize_env_assignment("foo=");
+ printf("%s\n", t);
+ free(t);
+
+ t = normalize_env_assignment("=");
+ printf("%s\n", t);
+ free(t);
+
+ t = normalize_env_assignment("");
+ printf("%s\n", t);
+ free(t);
+
+ t = normalize_env_assignment("a=\"waldo\"");
+ printf("%s\n", t);
+ free(t);
+
+ t = normalize_env_assignment("a=\"waldo");
+ printf("%s\n", t);
+ free(t);
+
+ t = normalize_env_assignment("a=waldo\"");
+ printf("%s\n", t);
+ free(t);
+
+ t = normalize_env_assignment("a=\'");
+ printf("%s\n", t);
+ free(t);
+
+ t = normalize_env_assignment("a=\'\'");
+ printf("%s\n", t);
+ free(t);
+
+ return 0;
}