Browse Source

Cleaning up install_script tests.

master
Jordan Harband 10 years ago
parent
commit
d30c0fe146
  1. 4
      package.json
  2. 5
      test/install_script/nvm_do_install
  3. 24
      test/install_script/nvm_reset

4
package.json

@ -9,9 +9,9 @@ @@ -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",

5
test/install_script/nvm_do_install

@ -1,6 +1,9 @@ @@ -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'

24
test/install_script/nvm_reset

@ -1,21 +1,29 @@ @@ -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

Loading…
Cancel
Save