Make tests work again,
This commit is contained in:
parent
7fca728668
commit
5f7b6b015f
|
@ -14,8 +14,6 @@ pub fn get_byte(reader: anytype) !u8 {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_string(reader: anytype, allocator: *std.mem.Allocator) ![]u8 {
|
pub fn get_string(reader: anytype, allocator: *std.mem.Allocator) ![]u8 {
|
||||||
var buffer: [1024]u8 = undefined;
|
|
||||||
|
|
||||||
return try reader.readUntilDelimiterAlloc(
|
return try reader.readUntilDelimiterAlloc(
|
||||||
allocator,
|
allocator,
|
||||||
'\x00',
|
'\x00',
|
||||||
|
|
|
@ -70,6 +70,12 @@ test "read/write stringlist" {
|
||||||
|
|
||||||
var fBS = std.io.fixedBufferStream(byteList.items);
|
var fBS = std.io.fixedBufferStream(byteList.items);
|
||||||
var val = try read.get_stringlist(fBS.reader(), global_allocator);
|
var val = try read.get_stringlist(fBS.reader(), global_allocator);
|
||||||
|
defer {
|
||||||
|
for (val.items) |str| {
|
||||||
|
global_allocator.free(str);
|
||||||
|
}
|
||||||
|
val.deinit();
|
||||||
|
}
|
||||||
|
|
||||||
try expect(arr.items.len == val.items.len);
|
try expect(arr.items.len == val.items.len);
|
||||||
for (arr.items) |str, index| {
|
for (arr.items) |str, index| {
|
||||||
|
|
Loading…
Reference in a new issue