| die () { echo "$@" ; cleanup ; exit 1; } |
| unset -f nvm_download nvm_ls_remote nvm_ls_remote_iojs |
| if [ -n TEMP_NVM_COLORS ]; then |
| export NVM_COLORS=TEMP_NVM_COLORS |
| if [ -n ${NVM_COLORS} ]; then |
| export TEMP_NVM_COLORS=NVM_COLORS |
| nvm deactivate 2>/dev/null || die 'unable to deactivate' |
| REMOTE="$PWD/mocks/nvm_ls_remote.txt" |
| REMOTE_IOJS="$PWD/mocks/nvm_ls_remote_iojs.txt" |
| EXPECTED_OUTPUT_PATH="$PWD/mocks/nvm ls-remote.txt" |
| OUTPUT="$(nvm ls-remote | sed 's/[ \t]*$//')" |
| EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH" | sed 's/[ \t]*$//' )" |
| [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "bare nvm ls-remote did not output expected sorted versions; got $(echo ">$OUTPUT<") expected $(echo ">$EXPECTED_OUTPUT<")" |