From: shane.xb.qian Date: Thu, 10 Nov 2022 02:50:58 +0000 (+0800) Subject: fix: correct/refine run test sh script X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=a7d55e2cb6dcfee18d36aed3d9542d0d37f0d2dc;p=vim-lsp.git fix: correct/refine run test sh script --- diff --git a/test/run_tests.sh b/test/run_tests.sh index 8116044..67a8182 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -2,7 +2,12 @@ # Script to run the unit-tests for the LSP Vim plugin -VIMPRG=${VIMPRG:=/usr/bin/vim} +VIMPRG=${VIMPRG:=`which vim`} +if [ -z "$VIMPRG" ]; then + echo "ERROR: Vim is not found or did not indicate." + exit 1 +fi + VIM_CMD="$VIMPRG -u NONE -U NONE -i NONE --noplugin -N --not-a-term" $VIM_CMD -S unit_tests.vim @@ -10,20 +15,18 @@ $VIM_CMD -S unit_tests.vim echo "LSP unit test results:" echo -if [ ! -f results.txt ] -then - echo "ERROR: Test results file 'results.txt' is not found" - exit 1 +if ! [ -f results.txt ]; then + echo "ERROR: Test results file 'results.txt' is not found." + exit 2 fi cat results.txt echo -grep FAIL results.txt > /dev/null 2>&1 -if [ $? -eq 0 ] -then +grep -w FAIL results.txt >/dev/null 2>&1 +if [ $? -eq 0 ]; then echo "ERROR: Some test(s) failed." - exit 1 + exit 3 fi echo "SUCCESS: All the tests passed."