Cleaning up install_script tests.

master
Jordan Harband 2014-10-28 13:47:21 -07:00
parent 21534ec0c9
commit d30c0fe146
3 changed files with 22 additions and 11 deletions

View File

@ -9,9 +9,9 @@
"test": "urchin test",
"test/fast": "urchin -f test/fast",
"test/slow": "urchin -f test/slow",
"test/install_script": "urchin -f test/install_script",
"test/installation": "urchin -f test/installation",
"test/sourcing": "urchin -f test/sourcing",
"test/install_script": "urchin -f test/install_script"
"test/sourcing": "urchin -f test/sourcing"
},
"repository": {
"type": "git",

View File

@ -1,6 +1,9 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
NVM_ENV=testing . ../../install.sh
#nvm_do_install is available
type nvm_do_install > /dev/null 2>&1
type nvm_do_install > /dev/null 2>&1 || die 'nvm_do_install is not available'

View File

@ -1,21 +1,29 @@
#!/bin/sh
cleanup () {
unset -f safe_type
}
die () { echo $@ ; cleanup ; exit 1; }
NVM_ENV=testing . ../../install.sh
safe_type() {
type "$1" > /dev/null 2>&1 && return 0 || return 1
type "$1" > /dev/null 2>&1
}
# Check nvm_reset exists
type nvm_reset > /dev/null 2>&1
safe_type nvm_reset || die 'nvm_reset is not available'
# Apply nvm_reset
nvm_reset
# The names should be unset
! safe_type nvm_do_install && \
! safe_type nvm_has && \
! safe_type nvm_download && \
! safe_type install_nvm_as_script && \
! safe_type install_nvm_from_git && \
! safe_type nvm_reset
! safe_type nvm_do_install || die 'nvm_do_install is still available'
! safe_type nvm_has || die 'nvm_has is still available'
! safe_type nvm_download || die 'nvm_download is still available'
! safe_type install_nvm_as_script || die 'install_nvm_as_script is still available'
! safe_type install_nvm_from_git || die 'install_nvm_from_git is still available'
! safe_type nvm_reset || die 'nvm_reset is still available'
cleanup