summaryrefslogtreecommitdiff
path: root/vim/pack/downloads/opt/lsp/test/run_tests.sh
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-07-01 21:26:30 -0500
committerMarc Coquand <marc@mccd.space>2024-07-01 21:26:30 -0500
commit0a20357d4585da91d92252972f3eb7b715ff64ab (patch)
treec1e228d72b6331e89f72d99a1ba4ba1807d60381 /vim/pack/downloads/opt/lsp/test/run_tests.sh
downloadopenbsd-0a20357d4585da91d92252972f3eb7b715ff64ab.tar.gz
openbsd-0a20357d4585da91d92252972f3eb7b715ff64ab.tar.bz2
openbsd-0a20357d4585da91d92252972f3eb7b715ff64ab.zip
initial commit
Diffstat (limited to 'vim/pack/downloads/opt/lsp/test/run_tests.sh')
-rwxr-xr-xvim/pack/downloads/opt/lsp/test/run_tests.sh51
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