mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-06-16 11:36:16 +08:00
fix(dotenv): apply review suggestions
This commit is contained in:
parent
cb0125629e
commit
052f587d00
@ -55,7 +55,7 @@ _parse_dotenv_content() {
|
||||
fi
|
||||
|
||||
[[ -z "$line" ]] || line+=" "
|
||||
line="$node"
|
||||
line+="$node"
|
||||
done
|
||||
|
||||
local -a forbidden_vars=(
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user