mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-29 04:53:17 +02:00
fix(dotenv): unknown vars should expand to empty
This commit is contained in:
parent
cb31ff6fd7
commit
9b19287c88
2 changed files with 55 additions and 7 deletions
|
|
@ -305,3 +305,25 @@ EOF
|
|||
|
||||
assert "DOTENV_TEST_VARS" var_same_as "expected_vars"
|
||||
}
|
||||
|
||||
@test 'parse in-file variable expansion prefers the longest matching variable name' {
|
||||
> "$fixture" <<'EOF'
|
||||
A=1
|
||||
ABC=2
|
||||
X=$ABC
|
||||
Y=${ABC}
|
||||
Z=$ABCD
|
||||
EOF
|
||||
|
||||
expected_vars=(
|
||||
A '1'
|
||||
ABC '2'
|
||||
X '2'
|
||||
Y '2'
|
||||
Z ''
|
||||
)
|
||||
|
||||
_parse_dotenv_test "$fixture"
|
||||
|
||||
assert "DOTENV_TEST_VARS" var_same_as "expected_vars"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue