Skip to content

Commit

Permalink
Revert "refactor tc_as_a_exe test"
Browse files Browse the repository at this point in the history
This reverts commit 9e9d761.
  • Loading branch information
WebFreak001 committed May 31, 2024
1 parent 9e9d761 commit 39599cb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 52 deletions.
34 changes: 28 additions & 6 deletions test/tc_as_a_exe/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ import core.thread;
import core.thread.fiber;

import served.lsp.filereader;
import served.lsp.jsonops;
import served.lsp.jsonrpc;
import served.lsp.protocol;
import served.lsp.uri;
import served.lsp.jsonops;

version (assert)
{
}
else
static assert(false, "Compile with asserts.");

__gshared RPCProcessor rpc;
__gshared string cwd;

// https://forum.dlang.org/post/[email protected]
void copyDir(string inDir, string outDir)
{
Expand Down Expand Up @@ -88,6 +91,25 @@ void main()
return;
}

void delegate(RequestMessageRaw msg) gotRequest;
void delegate(RequestMessageRaw msg) gotNotify;

shared static this()
{
gotRequest = toDelegate(&defaultRequestHandler);
gotNotify = toDelegate(&defaultNotifyHandler);
}

void defaultRequestHandler(RequestMessageRaw msg)
{
assert(false, "Unexpected request " ~ msg.toString);
}

void defaultNotifyHandler(RequestMessageRaw msg)
{
info("Ignoring notification " ~ msg.toString);
}

void pumpEvents()
{
while (rpc.hasData)
Expand All @@ -105,13 +127,13 @@ void doTests()
WorkspaceClientCapabilities workspace = {
configuration: opt(true)
};
InitializeParams init = InitializeParams(
processId: typeof(InitializeParams.processId)(thisProcessID),
InitializeParams init = {
processId: thisProcessID,
rootUri: uriFromFile(cwd),
capabilities: ClientCapabilities(
capabilities: {
workspace: opt(workspace)
)
);
}
};
auto msg = rpc.sendRequest("initialize", init, 10.seconds);
info("Response: ", msg.resultJson);

Expand Down
46 changes: 0 additions & 46 deletions test/tc_as_a_exe/source/tests/package.d

This file was deleted.

0 comments on commit 39599cb

Please sign in to comment.