Skip to content

Commit

Permalink
[Tests] fix cleanup in nvm_supports_xz unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 27, 2015
1 parent 31457fe commit 32d1840
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/fast/Unit tests/nvm_supports_xz
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#!/bin/sh

die () { echo $@ ; exit 1; }
OLDPATH=$PATH
TEST_PATH=../../xz-test

cleanup() {
rm -rf $TEST_PATH/{xz,which,awk,rm,command}
export PATH=$OLDPATH
}
die () { echo $@ ; cleanup ; exit 1; }

. ../../../nvm.sh

OLDPATH=$PATH
TEST_PATH=../../xz-test

mkdir $TEST_PATH
mkdir -p $TEST_PATH
touch ../../xz-test/xz
chmod +x ../../xz-test/xz

Expand All @@ -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

0 comments on commit 32d1840

Please sign in to comment.