diff options
author | Marc Coquand <marc@mccd.space> | 2024-06-30 17:20:44 -0500 |
---|---|---|
committer | Marc Coquand <marc@mccd.space> | 2024-06-30 17:20:44 -0500 |
commit | aeabdffa8870c2b90a32f53c1d0e5b63367a6e27 (patch) | |
tree | d3b8e3395cbfc5c9ba4f1dd28ff807f18d582b26 /vim/pack/downloads/opt/lsp/test/run_tests.sh | |
parent | 97ce8456231b997135be6c5f1afaee08eff2cbb1 (diff) | |
download | rcm-aeabdffa8870c2b90a32f53c1d0e5b63367a6e27.tar.gz rcm-aeabdffa8870c2b90a32f53c1d0e5b63367a6e27.tar.bz2 rcm-aeabdffa8870c2b90a32f53c1d0e5b63367a6e27.zip |
Vim
Diffstat (limited to 'vim/pack/downloads/opt/lsp/test/run_tests.sh')
-rwxr-xr-x | vim/pack/downloads/opt/lsp/test/run_tests.sh | 51 |
1 files changed, 51 insertions, 0 deletions
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 |