From a7d55e2cb6dcfee18d36aed3d9542d0d37f0d2dc Mon Sep 17 00:00:00 2001 From: "shane.xb.qian" Date: Thu, 10 Nov 2022 10:50:58 +0800 Subject: [PATCH] fix: correct/refine run test sh script --- test/run_tests.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) 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." -- 2.48.1