Fix `nvm_ensure_version_installed iojs` to not print an empty string for the version.
parent
014a44e154
commit
e3528b0d9e
4
nvm.sh
4
nvm.sh
|
@ -210,7 +210,9 @@ nvm_ensure_version_installed() {
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "N/A: version \"$PROVIDED_VERSION -> $VERSION\" is not yet installed" >&2
|
echo "N/A: version \"$PROVIDED_VERSION -> $VERSION\" is not yet installed" >&2
|
||||||
else
|
else
|
||||||
echo "N/A: version \"$(nvm_ensure_version_prefix "$PROVIDED_VERSION")\" is not yet installed" >&2
|
local PREFIXED_VERSION
|
||||||
|
PREFIXED_VERSION="$(nvm_ensure_version_prefix "$PROVIDED_VERSION")"
|
||||||
|
echo "N/A: version \"${PREFIXED_VERSION:-$PROVIDED_VERSION}\" is not yet installed" >&2
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -20,4 +20,11 @@ EXIT_CODE=$?
|
||||||
[ "_$OUTPUT" = "_" ] || die "expected 'nvm_ensure_version_installed 0.1' to have no output, got $OUTPUT"
|
[ "_$OUTPUT" = "_" ] || die "expected 'nvm_ensure_version_installed 0.1' to have no output, got $OUTPUT"
|
||||||
[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm_ensure_version_installed 0.1' to exit with 0, got $EXIT_CODE"
|
[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm_ensure_version_installed 0.1' to exit with 0, got $EXIT_CODE"
|
||||||
|
|
||||||
|
# Special case for "iojs"
|
||||||
|
OUTPUT="$(nvm_ensure_version_installed iojs 2>&1)"
|
||||||
|
EXIT_CODE=$?
|
||||||
|
EXPECTED_OUTPUT='N/A: version "iojs" is not yet installed'
|
||||||
|
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed iojs' to give $EXPECTED_OUTPUT, got $OUTPUT"
|
||||||
|
[ "_$EXIT_CODE" = "_1" ] || die "expected 'nvm_ensure_version_installed iojs' to exit with 1, got $EXIT_CODE"
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
|
|
Loading…
Reference in New Issue