fix tests

This commit is contained in:
SuperAuguste 2020-07-16 15:04:55 -04:00
parent f00d09c746
commit 5302cfbdbc
2 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ fn sendRequest(req: []const u8, process: *std.ChildProcess) !void {
try process.stdin.?.writeAll(req); try process.stdin.?.writeAll(req);
} }
fn readResponses(process: *std.ChildProcess, expected_responses: var) !void { fn readResponses(process: *std.ChildProcess, expected_responses: anytype) !void {
var seen = std.mem.zeroes([expected_responses.len]bool); var seen = std.mem.zeroes([expected_responses.len]bool);
while (true) { while (true) {
const header = headerPkg.readRequestHeader(allocator, process.stdout.?.reader()) catch |err| { const header = headerPkg.readRequestHeader(allocator, process.stdout.?.reader()) catch |err| {
@ -76,7 +76,7 @@ fn waitNoError(process: *std.ChildProcess) !void {
return error.ShutdownWithError; return error.ShutdownWithError;
} }
fn consumeOutputAndWait(process: *std.ChildProcess, expected_responses: var) !void { fn consumeOutputAndWait(process: *std.ChildProcess, expected_responses: anytype) !void {
process.stdin.?.close(); process.stdin.?.close();
process.stdin = null; process.stdin = null;
try readResponses(process, expected_responses); try readResponses(process, expected_responses);

View File

@ -24,7 +24,7 @@ fn makeUnnamedDocument(text: []const u8) !types.TextDocument {
return try makeDocument("test", text); return try makeDocument("test", text);
} }
fn testContext(comptime line: []const u8, comptime tag: var, comptime range: ?[]const u8) !void { fn testContext(comptime line: []const u8, comptime tag: anytype, comptime range: ?[]const u8) !void {
const cursor_idx = comptime std.mem.indexOf(u8, line, "<cursor>").?; const cursor_idx = comptime std.mem.indexOf(u8, line, "<cursor>").?;
const final_line = line[0..cursor_idx] ++ line[cursor_idx + "<cursor>".len ..]; const final_line = line[0..cursor_idx] ++ line[cursor_idx + "<cursor>".len ..];