about summary refs log tree commit diff
path: root/lang/zig/sentinel-terminated.zig
blob: dd9775caaf277364609179d4f013c0b042b037d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
const std = @import("std");
const expect = std.testing.expect;

test "null terminated array" {
    const array = [_:0]u8 {1, 2, 3, 4};

    expect(@TypeOf(array) == [4:0]u8);
    expect(array.len == 4);
    expect(array[4] == 0);
}