Browse Source

Modify nvm_version_path to use nvm_version_greater.

master
Jordan Harband 11 years ago
parent
commit
0a695c5d2a
  1. 4
      nvm.sh
  2. 2
      test/fast/Unit tests/nvm_version_path

4
nvm.sh

@ -122,8 +122,10 @@ nvm_version_path() {
if [ -z "$VERSION" ]; then if [ -z "$VERSION" ]; then
echo "version is required" >&2 echo "version is required" >&2
return 3 return 3
elif [ ! -z "$VERSION" ]; then elif nvm_version_greater 0.12.0 "$VERSION"; then
echo "$(nvm_version_dir old)/$VERSION" echo "$(nvm_version_dir old)/$VERSION"
else
echo "$(nvm_version_dir new)/$VERSION"
fi fi
} }

2
test/fast/Unit tests/nvm_version_path

@ -6,4 +6,6 @@ die () { echo $@ ; exit 1; }
[ "$(nvm_version_path foo)" = "$NVM_DIR/foo" ] || die '"nvm_version_path foo" did not return correct location' [ "$(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' [ "$(nvm_version_path 2>&1)" = "version is required" ] || die '"nvm_version_path" did not error out'
[ "$(nvm_version_path v0.11.0)" = "$NVM_DIR/v0.11.0" ] || die 'old version has the wrong path'
[ "$(nvm_version_path v0.12.0)" = "$NVM_DIR/versions/v0.12.0" ] || die 'new version has the wrong path'

Loading…
Cancel
Save