From 32d184099cd7ba2d11d816c1c70696e965592b3f Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 27 Dec 2015 13:18:28 -0800 Subject: [PATCH] [Tests] fix cleanup in nvm_supports_xz unit test --- test/fast/Unit tests/nvm_supports_xz | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/test/fast/Unit tests/nvm_supports_xz b/test/fast/Unit tests/nvm_supports_xz index c7e5a36..5a9e4f7 100755 --- a/test/fast/Unit tests/nvm_supports_xz +++ b/test/fast/Unit tests/nvm_supports_xz @@ -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