2015-09-09 10:15:38 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2015-12-28 05:18:28 +08:00
|
|
|
OLDPATH=$PATH
|
|
|
|
TEST_PATH=../../xz-test
|
|
|
|
|
|
|
|
cleanup() {
|
|
|
|
rm -rf $TEST_PATH/{xz,which,awk,rm,command}
|
|
|
|
export PATH=$OLDPATH
|
|
|
|
}
|
|
|
|
die () { echo $@ ; cleanup ; exit 1; }
|
2015-09-09 10:15:38 +08:00
|
|
|
|
2016-11-04 13:15:18 +08:00
|
|
|
\. ../../../nvm.sh
|
2015-09-09 10:15:38 +08:00
|
|
|
|
|
|
|
OLDPATH=$PATH
|
|
|
|
|
2015-12-28 05:18:28 +08:00
|
|
|
mkdir -p $TEST_PATH
|
2015-09-09 10:15:38 +08:00
|
|
|
touch ../../xz-test/xz
|
|
|
|
chmod +x ../../xz-test/xz
|
|
|
|
|
|
|
|
export PATH=$TEST_PATH:$PATH
|
|
|
|
|
|
|
|
$(nvm_supports_xz "v2.3.2") || \
|
|
|
|
die "expected 'nvm_supports_xz v2.3.2' to exit with 0"
|
|
|
|
|
|
|
|
$(nvm_supports_xz "v0.12.7") && \
|
|
|
|
die "expected 'nvm_supports_xz v0.12.7' to exit with 1"
|
|
|
|
|
|
|
|
|
|
|
|
# set up for a failure by having a minimal toolset available
|
|
|
|
# but remove xz
|
|
|
|
ln -s /usr/bin/which $TEST_PATH/which
|
|
|
|
ln -s /usr/bin/command $TEST_PATH/command
|
|
|
|
ln -s /usr/bin/awk $TEST_PATH/awk
|
|
|
|
ln -s $(which rm) $TEST_PATH/rm
|
|
|
|
|
|
|
|
export PATH=$TEST_PATH
|
|
|
|
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"
|
|
|
|
|
2015-12-28 05:18:28 +08:00
|
|
|
cleanup
|