From 243fc04164ee72074b054c34a6a7374a68054ba2 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 14 Sep 2014 16:04:04 -0700 Subject: [PATCH] Fixing these test files that have never been run --- ...-packages $(nvm ls current)\" should error out" | 14 +++++++++----- ...install version specified in .nvmrc from binary | 2 +- ...install version specified in .nvmrc from source | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git "a/test/slow/nvm copy-packages/Running \"nvm copy-packages $(nvm ls current)\" should error out" "b/test/slow/nvm copy-packages/Running \"nvm copy-packages $(nvm ls current)\" should error out" index 2e0d058..e296e7c 100755 --- "a/test/slow/nvm copy-packages/Running \"nvm copy-packages $(nvm ls current)\" should error out" +++ "b/test/slow/nvm copy-packages/Running \"nvm copy-packages $(nvm ls current)\" should error out" @@ -2,11 +2,15 @@ die () { echo $@ ; exit 1; } -. ../../nvm.sh +. ../../../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 > /dev/null -$(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' +EXPECTED_MSG="Can not copy packages from the current version of node." +ACTUAL_MSG="$(nvm copy-packages 0.10.28 2>&1 > /dev/null)" +[ "~$ACTUAL_MSG" = "~$EXPECTED_MSG" ] || die "'nvm use 0.10.28 && nvm copy-packages 0.10.28' did not fail with the right message: '$ACTUAL_MESSAGE'" + +EXPECTED_ERROR_CODE="2" +ACTUAL_ERROR_CODE="$(nvm copy-packages 0.10.28 > /dev/null 2>&1 ; echo $?)" +[ "~$ACTUAL_ERROR_CODE" = "~$EXPECTED_ERROR_CODE" ] || die "'nvm use 0.10.28 && nvm copy-packages 0.10.28' did not fail with the right error code: expected '$EXPECTED_ERROR_CODE', got '$ACTUAL_ERROR_CODE'" diff --git a/test/slow/nvm install/install version specified in .nvmrc from binary b/test/slow/nvm install/install version specified in .nvmrc from binary index dec2fe1..7758afe 100755 --- a/test/slow/nvm install/install version specified in .nvmrc from binary +++ b/test/slow/nvm install/install version specified in .nvmrc from binary @@ -9,7 +9,7 @@ NVM_TEST_VERSION=v0.10.7 [ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION # Install from binary -cat "$NVM_TEST_VERSION" > .nvmrc +echo "$NVM_TEST_VERSION" > .nvmrc nvm install diff --git a/test/slow/nvm install/install version specified in .nvmrc from source b/test/slow/nvm install/install version specified in .nvmrc from source index 6910228..189fffa 100755 --- a/test/slow/nvm install/install version specified in .nvmrc from source +++ b/test/slow/nvm install/install version specified in .nvmrc from source @@ -9,7 +9,7 @@ NVM_TEST_VERSION=v0.10.7 [ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION # Install from binary -cat "$NVM_TEST_VERSION" > .nvmrc +echo "$NVM_TEST_VERSION" > .nvmrc nvm install -s