blob: 563ed8e79b2c975b8ab52e1af2d2f42d4ba821f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
const std = @import("std");
test {
const string = "Hello!\x00World!";
try std.testing.expect(@TypeOf(string) == *const [13:0]u8);
const slice_without_sentinel: []const u8 = string[0..6];
try std.testing.expect(@TypeOf(slice_without_sentinel) == []const u8);
const slice_with_sentinel: [:0]const u8 = string[0..6 :0];
try std.testing.expect(@TypeOf(slice_with_sentinel) == [:0]const u8);
}
|