From 0a20357d4585da91d92252972f3eb7b715ff64ab Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Mon, 1 Jul 2024 21:26:30 -0500 Subject: initial commit --- vim/pack/downloads/opt/lsp/test/run_tests.sh | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 vim/pack/downloads/opt/lsp/test/run_tests.sh (limited to 'vim/pack/downloads/opt/lsp/test/run_tests.sh') diff --git a/vim/pack/downloads/opt/lsp/test/run_tests.sh b/vim/pack/downloads/opt/lsp/test/run_tests.sh new file mode 100755 index 0000000..1a1e69b --- /dev/null +++ b/vim/pack/downloads/opt/lsp/test/run_tests.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# Script to run the unit-tests for the LSP Vim plugin + +VIMPRG=${VIMPRG:=$(which vim)} +if [ -z "$VIMPRG" ]; then + echo "ERROR: vim (\$VIMPRG) is not found in PATH" + exit 1 +fi + +VIM_CMD="$VIMPRG -u NONE -U NONE -i NONE --noplugin -N --not-a-term" + +TESTS="clangd_tests.vim tsserver_tests.vim gopls_tests.vim not_lspserver_related_tests.vim markdown_tests.vim rust_tests.vim" + +RunTestsInFile() { + testfile=$1 + echo "Running tests in $testfile" + $VIM_CMD -c "let g:TestName='$testfile'" -S runner.vim + + if ! [ -f results.txt ]; then + echo "ERROR: Test results file 'results.txt' is not found." + exit 2 + fi + + cat results.txt + + if grep -qw FAIL results.txt; then + echo "ERROR: Some test(s) in $testfile failed." + exit 3 + fi + + echo "SUCCESS: All the tests in $testfile passed." + echo +} + +for testfile in $TESTS +do + RunTestsInFile $testfile +done + +for encoding in "utf-8" "utf-16" "utf-32" +do + export LSP_OFFSET_ENCODING=$encoding + echo "LSP offset encoding: $LSP_OFFSET_ENCODING" + RunTestsInFile clangd_offsetencoding.vim +done + +echo "SUCCESS: All the tests passed." +exit 0 + +# vim: shiftwidth=2 softtabstop=2 noexpandtab -- cgit v1.2.3