Make nvm copy-packages refuse to copy packages from the currently activated version.

This commit is contained in:
Jordan Harband
2014-09-05 00:42:59 -07:00
parent 110e571c34
commit ff1781b95d
2 changed files with 22 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
. ../../nvm.sh
local EXPECTED_MSG="Can not copy packages from the current version of node."
[ "$(nvm use 0.10.28 && nvm copy-packages 0.10.28 2&>1)" = "$EXPECTED_MSG" ] || die '"nvm use 0.10.28 && nvm copy-packages 0.10.28" did not fail with the right message'
$(nvm use 0.10.28 && nvm copy-packages 0.10.28)
[ $? = 2 ] || die '"nvm use 0.10.28 && nvm copy-packages 0.10.28" did not fail with the right error code'