Skip to content

Commit 32d1840

Browse files
committed
[Tests] fix cleanup in nvm_supports_xz unit test
1 parent 31457fe commit 32d1840

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/fast/Unit tests/nvm_supports_xz

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
#!/bin/sh
22

3-
die () { echo $@ ; exit 1; }
3+
OLDPATH=$PATH
4+
TEST_PATH=../../xz-test
5+
6+
cleanup() {
7+
rm -rf $TEST_PATH/{xz,which,awk,rm,command}
8+
export PATH=$OLDPATH
9+
}
10+
die () { echo $@ ; cleanup ; exit 1; }
411

512
. ../../../nvm.sh
613

714
OLDPATH=$PATH
8-
TEST_PATH=../../xz-test
915

10-
mkdir $TEST_PATH
16+
mkdir -p $TEST_PATH
1117
touch ../../xz-test/xz
1218
chmod +x ../../xz-test/xz
1319

@@ -33,4 +39,4 @@ rm $TEST_PATH/xz
3339
$(nvm_supports_xz "v2.3.2") && \
3440
die "expected 'nvm_supports_xz v2.3.2' with a missing xz binary to exit with 1"
3541

36-
export PATH=$OLDPATH
42+
cleanup

0 commit comments

Comments
 (0)