master
 1const std = @import("std");
 2const expect = std.testing.expect;
 3
 4test "0-terminated sentinel array" {
 5    const array = [_:0]u8{ 1, 2, 3, 4 };
 6
 7    try expect(@TypeOf(array) == [4:0]u8);
 8    try expect(array.len == 4);
 9    try expect(array[4] == 0);
10}
11
12test "extra 0s in 0-terminated sentinel array" {
13    // The sentinel value may appear earlier, but does not influence the compile-time 'len'.
14    const array = [_:0]u8{ 1, 0, 0, 4 };
15
16    try expect(@TypeOf(array) == [4:0]u8);
17    try expect(array.len == 4);
18    try expect(array[4] == 0);
19}
20
21// test