Skip to content
Myr

[Tests] try to make `nvm unload` test more robust

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jordan Harband · committed by Jordan Harband · parent 6c560b1 · Browse files · 1 file+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−3 removed

  • tests:+3 added−3 removed

1 file+3 added−3 removed

modified:test/fast/Running "nvm unload" should unset all function and variables.+3 added-3 removed
3 unmodified lines
45BEFORE="./before.tmp"6AFTER="./after.tmp"78cleanup () { rm -f "${BEFORE}" "${AFTER}"; }8cleanup () { echo rm -f "${BEFORE}" "${AFTER}"; }9die () { echo "$@" ; cleanup ; exit 1; }1011typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${BEFORE}"12env | grep -v PATH= | grep -v NVM_ >> "${BEFORE}"12env | grep -v PATH= | grep -v IFS= | grep -v NVM_ | sort >> "${BEFORE}"1314set +e # TODO: fix15\. ../../nvm.sh16set -e
2 unmodified lines
1920nvm unload2122typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${AFTER}"23env | grep -v PATH= >> "${AFTER}"23env | grep -v PATH= | grep -v IFS= | sort >> "${AFTER}"2425! type nvm > /dev/null 2>&1 || die "nvm not unloaded"2627DIFF="$(diff "${BEFORE}" "${AFTER}" ||:)"
3 unmodified lines