summaryrefslogtreecommitdiff
path: root/src/test/test-env-replace.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2015-10-07 14:40:44 +0200
committerMichal Schmidt <mschmidt@redhat.com>2015-10-07 14:43:55 +0200
commitdf553b586b7c11fc660bb1829c339fb005bbbead (patch)
treeed79066e99ea0873a0bf7898ae667892000cdb2a /src/test/test-env-replace.c
parent42911a567dc22c3115fb3ee3c56a7dcfb034f102 (diff)
basic: fix env expansion for strings leading with two dollar signs
The way to escape a literal dollar sign is to write "$$". But this does not work right if it's at the beginning of the argument. Fix it.
Diffstat (limited to 'src/test/test-env-replace.c')
-rw-r--r--src/test/test-env-replace.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/test-env-replace.c b/src/test/test-env-replace.c
index 2e28c0c49b..110223f3b8 100644
--- a/src/test/test-env-replace.c
+++ b/src/test/test-env-replace.c
@@ -118,6 +118,8 @@ static void test_replace_env_arg(void) {
"$FOO$FOO",
"${FOO}${BAR}",
"${FOO",
+ "FOO$$${FOO}",
+ "$$FOO${FOO}",
NULL
};
_cleanup_strv_free_ char **r = NULL;
@@ -133,7 +135,9 @@ static void test_replace_env_arg(void) {
assert_se(streq(r[6], "BAR"));
assert_se(streq(r[7], "BAR BARwaldo"));
assert_se(streq(r[8], "${FOO"));
- assert_se(strv_length(r) == 9);
+ assert_se(streq(r[9], "FOO$BAR BAR"));
+ assert_se(streq(r[10], "$FOOBAR BAR"));
+ assert_se(strv_length(r) == 11);
}
static void test_env_clean(void) {