From ffe9598fbdb76d2d18a00a45f27889999a523f85 Mon Sep 17 00:00:00 2001 From: Lee Cannon Date: Sun, 29 May 2022 18:45:08 +0100 Subject: [PATCH] fix tests --- tests/sessions.zig | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/tests/sessions.zig b/tests/sessions.zig index 8212d42..9c5a350 100644 --- a/tests/sessions.zig +++ b/tests/sessions.zig @@ -154,10 +154,10 @@ test "Open file, ask for semantic tokens" { defer server.shutdown(); 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); 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]} ); @@ -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}]} ); } -test "Missing return type" { - var server = try Server.start(initialize_msg, null); - defer server.shutdown(); - 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}]} - ); -} +// This test as written depends on the configuration in the *host* machines zls.json, if `enable_snippets` is true then +// the insert text is "w()" if it is false it is "w" +// +// test "Missing return type" { +// var server = try Server.start(initialize_msg, null); +// defer server.shutdown(); + +// 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" { var server = try Server.start(initialize_msg, null);