2014-10-23 01:43:39 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2014-10-29 04:47:21 +08:00
|
|
|
cleanup () {
|
2014-10-29 20:05:11 +08:00
|
|
|
unset -f safe_type die cleanup
|
2014-10-29 04:47:21 +08:00
|
|
|
}
|
|
|
|
die () { echo $@ ; cleanup ; exit 1; }
|
|
|
|
|
2014-10-23 01:43:39 +08:00
|
|
|
safe_type() {
|
2015-12-22 15:59:44 +08:00
|
|
|
type "$1"
|
2014-10-23 01:43:39 +08:00
|
|
|
}
|
|
|
|
|
2015-12-22 15:59:44 +08:00
|
|
|
# precondition: the names should be unset
|
|
|
|
! 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'
|
|
|
|
! safe_type nvm_detect_profile || die 'nvm_detect_profile is still available'
|
|
|
|
|
|
|
|
NVM_ENV=testing . ../../install.sh
|
|
|
|
|
2014-10-23 01:43:39 +08:00
|
|
|
# Check nvm_reset exists
|
2014-10-29 04:47:21 +08:00
|
|
|
safe_type nvm_reset || die 'nvm_reset is not available'
|
2014-10-23 01:43:39 +08:00
|
|
|
|
|
|
|
# Apply nvm_reset
|
2015-04-28 07:55:21 +08:00
|
|
|
nvm_reset || die 'nvm_reset failed'
|
2014-10-23 01:43:39 +08:00
|
|
|
|
|
|
|
# The names should be unset
|
2014-10-29 04:47:21 +08:00
|
|
|
! 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'
|
2014-10-29 20:05:11 +08:00
|
|
|
! safe_type nvm_detect_profile || die 'nvm_detect_profile is still available'
|
2014-10-29 04:47:21 +08:00
|
|
|
|
|
|
|
cleanup
|
|
|
|
|