diff options
author | Mitsuo Heijo <mitsuo.heijo@gmail.com> | 2019-12-24 23:38:50 +0900 |
---|---|---|
committer | Mitsuo Heijo <mitsuo.heijo@gmail.com> | 2019-12-24 23:39:14 +0900 |
commit | c61632d625d340db4dcb4cc57c7d1d38fac5ccb8 (patch) | |
tree | 3da978115f86719d344ac34d1d51df94d39a5d5c /test | |
parent | 6bb33eb9bfeb5f2edf29f6fe517dd94014e67e88 (diff) | |
download | vim-lsp-settings-c61632d625d340db4dcb4cc57c7d1d38fac5ccb8.tar.gz vim-lsp-settings-c61632d625d340db4dcb4cc57c7d1d38fac5ccb8.tar.bz2 vim-lsp-settings-c61632d625d340db4dcb4cc57c7d1d38fac5ccb8.zip |
feature: support metals, fortls
- fix: imporve npm and pip install
- proposal: add simple test script
Diffstat (limited to 'test')
-rwxr-xr-x | test/run.sh | 31 | ||||
-rwxr-xr-x | test/send.py | 42 |
2 files changed, 73 insertions, 0 deletions
diff --git a/test/run.sh b/test/run.sh new file mode 100755 index 0000000..66ebde0 --- /dev/null +++ b/test/run.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -e + +usage() { + cat <<USAGE +Usage: $0 [pattern] [args...] +Examples +$0 pyls +$0 "pyls|kotlin" +$0 bash start +USAGE +} + +if [ $# == 0 ]; then + usage + exit 1 +fi + +test_installer() { + set -e + "./installer/install-$1.sh" + ./test/send.py | "./servers/$1/$1" $2 + ret="$?" + printf "\n\nresult=%s" $ret +} +export -f test_installer + +jq ".[][].command" -r -c <./settings.json | sort | uniq | + grep -E "$1" | + xargs -I% bash -c "test_installer % $2" diff --git a/test/send.py b/test/send.py new file mode 100755 index 0000000..78b89aa --- /dev/null +++ b/test/send.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +import json +import sys + + +def send(message: dict): + raw = json.dumps(message) + message = "Content-Length: " + str(len(raw)) + "\r\n\r\n" + raw + sys.stdout.write(message) + + +initialize = { + "jsonrpc": "2.0", + "id": 1, + "method": "initialize", + "params": {"processId": None, "rootUri": None, "capabilities": {}}, +} +send(initialize) + +initialized = { + "jsonrpc": "2.0", + "id": 2, + "method": "initialized", + "params": {}, +} +send(initialized) + +shutdown = { + "jsonrpc": "2.0", + "id": 3, + "method": "shutdown", + "params": {}, +} +send(shutdown) + +_exit = { + "jsonrpc": "2.0", + "id": 4, + "method": "exit", + "params": {}, +} +send(_exit) |