test_null_terminated_slice.zig (208B) - Raw
1 const std = @import("std"); 2 const expect = std.testing.expect; 3 4 test "0-terminated slice" { 5 const slice: [:0]const u8 = "hello"; 6 7 try expect(slice.len == 5); 8 try expect(slice[5] == 0); 9 } 10 11 // test