mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-08-07 06:08:39 +02:00
fix(dotenv): apply review suggestions
This commit is contained in:
parent
cb0125629e
commit
052f587d00
3 changed files with 12 additions and 2 deletions
|
|
@ -55,7 +55,7 @@ _parse_dotenv_content() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -z "$line" ]] || line+=" "
|
[[ -z "$line" ]] || line+=" "
|
||||||
line="$node"
|
line+="$node"
|
||||||
done
|
done
|
||||||
|
|
||||||
local -a forbidden_vars=(
|
local -a forbidden_vars=(
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ _parse_dotenv_export() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Helper: Run parse_dotenv supressing stderr
|
# Helper: Run parse_dotenv suppressing stderr
|
||||||
_parse_dotenv_quiet() {
|
_parse_dotenv_quiet() {
|
||||||
parse_dotenv "$@" 2>/dev/null
|
parse_dotenv "$@" 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -250,6 +250,16 @@ EOF
|
||||||
assert "DOTENV_TEST_VARS" var_same_as "expected_vars"
|
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' {
|
@test 'parse special characters' {
|
||||||
> "$fixture" <<'EOF'
|
> "$fixture" <<'EOF'
|
||||||
# Special characters
|
# Special characters
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue