zig/doc/langref/test_null_terminated_slice.zig

12 lines
208 B
Zig
Raw Normal View History

const std = @import("std");
const expect = std.testing.expect;
test "0-terminated slice" {
const slice: [:0]const u8 = "hello";
try expect(slice.len == 5);
try expect(slice[5] == 0);
}
// test