Hi Folks,
I have the following code:
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
test "endofstring" {
const buffer: []u8 = try testing.allocator.alloc(u8,16);
defer testing.allocator.free(buffer);
buffer[0] = 'F';
buffer[1] = 'O';
buffer[2] = 'O';
try testing.expectEqualStrings("FOO", buffer);
}
The output of the test is:
====== expected this output: =========
FOO␃
======== instead found this: =========
FOO�������������␃
======================================
How can I add the end-of-string after “FOO” instead of at the end of the allocated buffer (without using something like std.Io.Writer).