[Tests] fix cleanup in nvm_supports_xz unit test

Jordan Harband 2015-12-27 13:18:28 -08:00
parent 31457fec3f
commit 32d184099c
1 changed files with 12 additions and 6 deletions

View File

@ -1,13 +1,19 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
OLDPATH=$PATH
TEST_PATH=../../xz-test
mkdir $TEST_PATH
cleanup() {
rm -rf $TEST_PATH/{xz,which,awk,rm,command}
export PATH=$OLDPATH
}
die () { echo $@ ; cleanup ; exit 1; }
. ../../../nvm.sh
OLDPATH=$PATH
mkdir -p $TEST_PATH
touch ../../xz-test/xz
chmod +x ../../xz-test/xz
@ -33,4 +39,4 @@ rm $TEST_PATH/xz
$(nvm_supports_xz "v2.3.2") && \
die "expected 'nvm_supports_xz v2.3.2' with a missing xz binary to exit with 1"
export PATH=$OLDPATH
cleanup