mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-10-11 00:00:13 +08:00
21 lines
603 B
Bash
Executable File
21 lines
603 B
Bash
Executable File
#!/bin/sh
|
|
|
|
die () { echo "$@" ; exit 1; }
|
|
|
|
: nvm.sh
|
|
\. ../../../nvm.sh
|
|
|
|
nvm_version() {
|
|
echo 'nvm_version was called' >&2
|
|
return 42
|
|
}
|
|
|
|
EXACT="$(nvm_resolve_local_alias test-stable-1)"
|
|
[ "_$EXACT" = "_v0.0.1" ] || die "'nvm_resolve_local_alias test-stable-1' was not v0.0.1; got $EXACT"
|
|
|
|
echo v0.0.99 > ../../../alias/test-not-installed
|
|
NOT_INSTALLED="$(nvm_resolve_local_alias test-not-installed 2>/dev/null)"
|
|
EXIT_CODE=$?
|
|
rm -f ../../../alias/test-not-installed
|
|
[ "_$EXIT_CODE" = "_42" ] || die "an exact version that is not installed should still go through nvm_version; got exit code $EXIT_CODE"
|