fix(dotenv): unknown vars should expand to empty

This commit is contained in:
Carlo Sala 2026-04-16 20:09:26 +02:00
commit 9b19287c88
No known key found for this signature in database
GPG key ID: DA6FB450C1A4FE9A
2 changed files with 55 additions and 7 deletions

View file

@ -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"
}