fix(dotenv): apply review suggestions

This commit is contained in:
Marc Cornellà 2026-05-28 20:04:46 +02:00
parent cb0125629e
commit 052f587d00
3 changed files with 12 additions and 2 deletions

View File

@ -55,7 +55,7 @@ _parse_dotenv_content() {
fi
[[ -z "$line" ]] || line+=" "
line="$node"
line+="$node"
done
local -a forbidden_vars=(

View File

@ -23,7 +23,7 @@ _parse_dotenv_export() {
done
}
# Helper: Run parse_dotenv supressing stderr
# Helper: Run parse_dotenv suppressing stderr
_parse_dotenv_quiet() {
parse_dotenv "$@" 2>/dev/null
}

View File

@ -250,6 +250,16 @@ EOF
assert "DOTENV_TEST_VARS" var_same_as "expected_vars"
}
@test 'parse ignores non-assignment commands with assignment-looking arguments' {
> "$fixture" <<'EOF'
print SHOULD_NOT_PARSE=value
EOF
_parse_dotenv_test "$fixture"
assert "DOTENV_TEST_VARS" var_same_as "expected_vars"
}
@test 'parse special characters' {
> "$fixture" <<'EOF'
# Special characters