test(cli): harden startup coverage

This commit is contained in:
csh
2026-07-11 21:58:33 +08:00
parent 100cfc0d0e
commit 98c05323cb
3 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -57,6 +57,6 @@ if(BUILD_TESTS)
${CMAKE_CURRENT_LIST_DIR}/test_cli_startup.py ${CMAKE_CURRENT_LIST_DIR}/test_cli_startup.py
--server $<TARGET_FILE:tsl-server>) --server $<TARGET_FILE:tsl-server>)
else() else()
message(WARNING "python3 not found; skipping test_lsp_json registration") message(WARNING "python3 not found; skipping test_lsp_json and test_cli_startup registration")
endif() endif()
endif() endif()
+1
View File
@@ -16,6 +16,7 @@ def run_server(*arguments: str) -> subprocess.CompletedProcess[bytes]:
input=b"", input=b"",
capture_output=True, capture_output=True,
check=False, check=False,
timeout=5,
) )
+1 -1
View File
@@ -2,4 +2,4 @@
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
JSON='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":null,"rootUri":"file:///tmp","capabilities":{}}}' JSON='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":null,"rootUri":"file:///tmp","capabilities":{}}}'
LENGTH=$(echo -n "$JSON" | wc -c) LENGTH=$(echo -n "$JSON" | wc -c)
printf "Content-Length: %d\r\n\r\n%s" $LENGTH "$JSON" | "$SCRIPT_DIR/../vscode/bin/tsl-server" --log=verbose --log-stderr printf "Content-Length: %d\r\n\r\n%s" $LENGTH "$JSON" | "$SCRIPT_DIR/../vscode/bin/tsl-server" --log=trace