mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-09-10 16:49:06 +00:00
testing NVM_DIR
This commit is contained in:
25
test/install_script/nvm_install_dir
Executable file
25
test/install_script/nvm_install_dir
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
cleanup () {
|
||||
unset -f die cleanup
|
||||
unset install_dir
|
||||
}
|
||||
die () { echo $@ ; cleanup ; exit 1; }
|
||||
|
||||
NVM_ENV=testing . ../../install.sh
|
||||
HOME="__home__"
|
||||
|
||||
|
||||
# NVM_DIR is set
|
||||
NVM_DIR="some_dir"
|
||||
install_dir=$(nvm_install_dir)
|
||||
[ "_$install_dir" = "_$NVM_DIR" ] || die "nvm_install_dir should use \$NVM_DIR if it exists. Current output: $install_dir"
|
||||
|
||||
unset NVM_DIR
|
||||
|
||||
# NVM_DIR is not set
|
||||
install_dir=$(nvm_install_dir)
|
||||
[ "_$install_dir" = "_$HOME/.nvm" ] || die "nvm_install_dir should default to \$HOME/.nvm. Current output: $install_dir"
|
||||
|
||||
cleanup
|
||||
|
Reference in New Issue
Block a user