[Tests] add test to ensure that `nvm unload` unloads all functions.
parent
c96c561c88
commit
47c60dfc1d
2
nvm.sh
2
nvm.sh
|
@ -3172,7 +3172,7 @@ nvm() {
|
|||
nvm_list_aliases nvm_make_alias nvm_print_alias_path \
|
||||
nvm_print_default_alias nvm_print_formatted_alias nvm_resolve_local_alias \
|
||||
nvm_sanitize_path nvm_has_colors nvm_process_parameters \
|
||||
node_version_has_solaris_binary \
|
||||
node_version_has_solaris_binary iojs_version_has_solaris_binary \
|
||||
> /dev/null 2>&1
|
||||
unset RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_IOJS_ORG_MIRROR NVM_DIR \
|
||||
NVM_CD_FLAGS NVM_BIN NVM_MAKE_JOBS NVM_PATH \
|
||||
|
|
|
@ -2,7 +2,13 @@
|
|||
|
||||
set -ex
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
BEFORE="./before.tmp"
|
||||
AFTER="./after.tmp"
|
||||
|
||||
cleanup () { rm -f "${BEFORE}" "${AFTER}"; }
|
||||
die () { echo "$@" ; cleanup ; exit 1; }
|
||||
|
||||
typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${BEFORE}"
|
||||
|
||||
\. ../../nvm.sh
|
||||
|
||||
|
@ -10,4 +16,11 @@ type nvm > /dev/null 2>&1 || die "nvm not loaded"
|
|||
|
||||
nvm unload
|
||||
|
||||
typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${AFTER}"
|
||||
|
||||
! type nvm > /dev/null 2>&1 || die "nvm not unloaded"
|
||||
|
||||
DIFF="$(diff "${BEFORE}" "${AFTER}" ||:)"
|
||||
[ -z "${DIFF}" ] || die "function pollution found: ${DIFF}"
|
||||
|
||||
cleanup
|
||||
|
|
Loading…
Reference in New Issue