fix tests

This commit is contained in:
Lee Cannon 2022-05-29 18:45:08 +01:00
parent dcc125e115
commit ffe9598fbd
No known key found for this signature in database
GPG Key ID: 983D5E5CC5E1401F

View File

@ -154,10 +154,10 @@ test "Open file, ask for semantic tokens" {
defer server.shutdown(); defer server.shutdown();
try server.request("textDocument/didOpen", try server.request("textDocument/didOpen",
\\{"textDocument":{"uri":"file://./tests/test.zig","languageId":"zig","version":420,"text":"const std = @import(\"std\");"}} \\{"textDocument":{"uri":"file:///test.zig","languageId":"zig","version":420,"text":"const std = @import(\"std\");"}}
, null); , null);
try server.request("textDocument/semanticTokens/full", try server.request("textDocument/semanticTokens/full",
\\{"textDocument":{"uri":"file://./tests/test.zig"}} \\{"textDocument":{"uri":"file:///test.zig"}}
, ,
\\{"data":[0,0,5,7,0,0,6,3,0,33,0,4,1,11,0,0,2,7,12,0,0,8,5,9,0]} \\{"data":[0,0,5,7,0,0,6,3,0,33,0,4,1,11,0,0,2,7,12,0,0,8,5,9,0]}
); );
@ -217,19 +217,23 @@ test "Self-referential definition" {
\\{"isIncomplete":false,"items":[{"label":"h","kind":21,"textEdit":null,"filterText":null,"insertText":"h","insertTextFormat":1,"detail":"const h = h(0)","documentation":null}]} \\{"isIncomplete":false,"items":[{"label":"h","kind":21,"textEdit":null,"filterText":null,"insertText":"h","insertTextFormat":1,"detail":"const h = h(0)","documentation":null}]}
); );
} }
test "Missing return type" {
var server = try Server.start(initialize_msg, null);
defer server.shutdown();
try server.request("textDocument/didOpen", // This test as written depends on the configuration in the *host* machines zls.json, if `enable_snippets` is true then
\\{"textDocument":{"uri":"file:///test.zig","languageId":"zig","version":420,"text":"fn w() {}\nc"}} // the insert text is "w()" if it is false it is "w"
, null); //
try server.request("textDocument/completion", // test "Missing return type" {
\\{"textDocument":{"uri":"file:///test.zig"}, "position":{"line":1,"character":1}} // var server = try Server.start(initialize_msg, null);
, // defer server.shutdown();
\\{"isIncomplete":false,"items":[{"label":"w","kind":3,"textEdit":null,"filterText":null,"insertText":"w","insertTextFormat":1,"detail":"fn","documentation":null}]}
); // try server.request("textDocument/didOpen",
} // \\{"textDocument":{"uri":"file:///test.zig","languageId":"zig","version":420,"text":"fn w() {}\nc"}}
// , null);
// try server.request("textDocument/completion",
// \\{"textDocument":{"uri":"file:///test.zig"}, "position":{"line":1,"character":1}}
// ,
// \\{"isIncomplete":false,"items":[{"label":"w","kind":3,"textEdit":null,"filterText":null,"insertText":"w","insertTextFormat":1,"detail":"fn","documentation":null}]}
// );
// }
test "Pointer and optional deref" { test "Pointer and optional deref" {
var server = try Server.start(initialize_msg, null); var server = try Server.start(initialize_msg, null);