aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/bugs/12033.zig
blob: b7ff501e35d7f5ee7a4e7eba8c04ac71c764266c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
const std = @import("std");
const builtin = @import("builtin");

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);
}