lua-language-server: add smoke test
This was mostly taken from vtsls.
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
|
||||
versionCheckHook,
|
||||
nix-update-script,
|
||||
runCommand,
|
||||
lua-language-server,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
@@ -128,7 +130,26 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
];
|
||||
doInstallCheck = true;
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
|
||||
tests.smoke = runCommand "lua-language-server-smoke-test" { } ''
|
||||
export XDG_CACHE_HOME=$(mktemp -d)
|
||||
|
||||
INIT_REQUEST='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":null,"rootUri":"file:///tmp","workspaceFolders":[{"uri":"file:///tmp","name":"test"}],"capabilities":{}}}'
|
||||
CONTENT_LENGTH=''${#INIT_REQUEST}
|
||||
|
||||
RESPONSE=$(
|
||||
{
|
||||
printf "Content-Length: %d\r\n\r\n%s" "$CONTENT_LENGTH" "$INIT_REQUEST"
|
||||
sleep 1
|
||||
} | timeout 3 ${lib.getExe lua-language-server} --stdio 2>&1 | head -c 1000
|
||||
) || true
|
||||
|
||||
echo "$RESPONSE" | grep -q '"capabilities"'
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Language server that offers Lua language support";
|
||||
|
||||
Reference in New Issue
Block a user