2014-10-23 01:43:39 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-11-07 03:34:36 +08:00
|
|
|
die () { echo "$@" ; exit 1; }
|
2014-10-29 04:47:21 +08:00
|
|
|
|
2016-11-04 13:15:18 +08:00
|
|
|
NVM_ENV=testing \. ../../install.sh
|
2014-10-23 01:43:39 +08:00
|
|
|
|
|
|
|
#nvm_do_install is available
|
2014-10-29 04:47:21 +08:00
|
|
|
type nvm_do_install > /dev/null 2>&1 || die 'nvm_do_install is not available'
|
2022-12-28 14:57:07 +08:00
|
|
|
|
|
|
|
FILE_PATH="$(pwd)/nvm_do_install"
|
|
|
|
echo $FILE_PATH
|
|
|
|
$(NVM_DIR="${FILE_PATH}" nvm_do_install >/dev/null 2>&1)
|
|
|
|
EXIT_CODE=$(echo $?)
|
|
|
|
[ "${EXIT_CODE}" = '1' ] || die "nvm_do_install should fail if NVM_DIR is a file: expected 1, got <${EXIT_CODE}>"
|
|
|
|
|
|
|
|
ACTUAL="$(NVM_DIR="${FILE_PATH}" nvm_do_install 2>&1)"
|
|
|
|
EXPECTED="File \"${FILE_PATH}\" has the same name as installation directory."
|
|
|
|
[ "${ACTUAL}" = "${EXPECTED}" ] || die "got <${ACTUAL}>, expected <${EXPECTED}>"
|