summaryrefslogtreecommitdiff
path: root/src/test/test-fileio.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-11 14:05:10 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-20 23:30:50 -0500
commitccad1fd07ce4eb40a2fcf81cfb55d9b41fdcac48 (patch)
tree41b72c7747d8072e212ed58fd8b5c1e71c18d0b7 /src/test/test-fileio.c
parentcb4499d0056a7c974d7d3695cc355c7e77edc938 (diff)
Allow braceless variables to be expanded
(Only in environment.d files.) We have only basic compatibility with shell syntax, but specifying variables without using braces is probably more common, and I think a lot of people would be surprised if this didn't work.
Diffstat (limited to 'src/test/test-fileio.c')
-rw-r--r--src/test/test-fileio.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index 84f394a713..c204cbae22 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -226,7 +226,10 @@ static void test_merge_env_file(void) {
"twelve=${one}2\n"
"twentyone=2${one}\n"
"one=2\n"
- "twentytwo=2${one}\n", false);
+ "twentytwo=2${one}\n"
+ "xxx_minus_three=$xxx - 3\n"
+ "xxx=0x$one$one$one\n"
+ , false);
assert(r >= 0);
r = merge_env_file(&a, NULL, t);
@@ -240,8 +243,9 @@ static void test_merge_env_file(void) {
assert_se(streq(a[1], "twelve=12"));
assert_se(streq(a[2], "twentyone=21"));
assert_se(streq(a[3], "twentytwo=22"));
- assert_se(a[4] == NULL);
-
+ assert_se(streq(a[4], "xxx=0x222"));
+ assert_se(streq(a[5], "xxx_minus_three= - 3"));
+ assert_se(a[6] == NULL);
r = merge_env_file(&a, NULL, t);
assert_se(r >= 0);
@@ -254,7 +258,9 @@ static void test_merge_env_file(void) {
assert_se(streq(a[1], "twelve=12"));
assert_se(streq(a[2], "twentyone=21"));
assert_se(streq(a[3], "twentytwo=22"));
- assert_se(a[4] == NULL);
+ assert_se(streq(a[4], "xxx=0x222"));
+ assert_se(streq(a[5], "xxx_minus_three=0x222 - 3"));
+ assert_se(a[6] == NULL);
}
static void test_executable_is_script(void) {