Fixed unit tests
This commit is contained in:
parent
bba069526c
commit
70cfba0eb9
@ -134,7 +134,7 @@ pub const TextDocument = struct {
|
||||
};
|
||||
|
||||
pub fn borrowNullTerminatedSlice(self: *const @This(), start_idx: usize, end_idx: usize) Held {
|
||||
std.debug.assert(end_idx >= start_idx and end_idx < self.text.len);
|
||||
std.debug.assert(end_idx >= start_idx);
|
||||
const popped_char = self.mem[end_idx];
|
||||
self.mem[end_idx] = 0;
|
||||
return .{
|
||||
|
@ -8,13 +8,14 @@ const std = @import("std");
|
||||
const allocator = std.testing.allocator;
|
||||
|
||||
fn makeDocument(uri: []const u8, text: []const u8) !types.TextDocument {
|
||||
const mem = try allocator.alloc(u8, text.len);
|
||||
const mem = try allocator.alloc(u8, text.len + 1);
|
||||
std.mem.copy(u8, mem, text);
|
||||
mem[text.len] = 0;
|
||||
|
||||
return types.TextDocument{
|
||||
.uri = uri,
|
||||
.mem = mem,
|
||||
.text = mem[0..],
|
||||
.text = mem[0..text.len :0],
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user