Browse Source

Use nvm_version_dir in nvm_version_path

nvm_version_path
Jordan Harband 10 years ago
parent
commit
a2da9abd6d
  1. 5
      nvm.sh
  2. 4
      test/fast/Unit tests/nvm_version_path

5
nvm.sh

@ -112,9 +112,10 @@ nvm_version_path() {
local VERSION
VERSION="$1"
if [ -z "$VERSION" ]; then
echo "$NVM_DIR"
echo "version is required" >&2
return 3
elif [ ! -z "$VERSION" ]; then
echo "$NVM_DIR/$VERSION"
echo "$(nvm_version_dir old)/$VERSION"
fi
}

4
test/fast/Unit tests/nvm_version_path

@ -4,6 +4,6 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh
[ "$(nvm_version_path)" = "$NVM_DIR" ] &&
[ "$(nvm_version_path foo)" = "$NVM_DIR/foo" ]
[ "$(nvm_version_path foo)" = "$NVM_DIR/foo" ] || die '"nvm_version_path foo" did not return correct location'
[ "$(nvm_version_path 2>&1)" = "version is required" ] || die '"nvm_version_path" did not error out'

Loading…
Cancel
Save