test/run_tests.sh | 21 ++++++++++++--------- diff --git a/test/run_tests.sh b/test/run_tests.sh index 811604424ff131b04dd1ebf3aa668bb3df846774..67a8182b9f5202b4d63802a169d14d3931c64865 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -2,7 +2,12 @@ #!/bin/bash # 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 @@ 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."