diff --git a/package.json b/package.json index d5ebb31..0e2fc67 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/install_script/nvm_do_install b/test/install_script/nvm_do_install index 02c77f3..a969602 100755 --- a/test/install_script/nvm_do_install +++ b/test/install_script/nvm_do_install @@ -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' + diff --git a/test/install_script/nvm_reset b/test/install_script/nvm_reset index 25d9a34..4005d9c 100755 --- a/test/install_script/nvm_reset +++ b/test/install_script/nvm_reset @@ -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 +