Writing end-of-string to a buffer
Ziggit
Writing end-of-string to a buffer
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�������������␃ =====...
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…
0 comments
No comments yet.