tests(export): ensure previous value of variable works correctly

This commit is contained in:
Khaïs COLIN 2025-04-25 14:51:20 +02:00
parent 29187f08da
commit a040ad5613

27
test.sh
View file

@ -1139,4 +1139,31 @@ expecting <<"EOF"
- hello' 'world - - hello' 'world -
EOF EOF
when_run <<"EOF" "previous variable value in export"
export VAR=hello
export VAR=" $VAR and goodbye"
echo $VAR | cat -e
EOF
expecting <<EOF
hello and goodbye$
EOF
when_run <<"EOF" "previous variable value in export, but single-quoted"
export VAR=hello
export VAR=' $VAR and goodbye'
echo $VAR | cat -e
EOF
expecting <<"EOF"
$VAR and goodbye$
EOF
when_run <<"EOF" "previous variable value in export, with word joining"
export VAR=hello
export VAR=" $VAR and goodbye"$VAR
echo $VAR | cat -e
EOF
expecting <<EOF
hello and goodbyehello$
EOF
finalize finalize