aboutsummaryrefslogtreecommitdiff
path: root/doc/langref/test_null_terminated_slice.zig
blob: 9f14f9bc1d6f3c466a5785cb6331ca4ad507a438 (plain)
1
2
3
4
5
6
7
8
9
10
11
const std = @import("std");
const expect = std.testing.expect;

test "0-terminated slice" {
    const slice: [:0]const u8 = "hello";

    try expect(slice.len == 5);
    try expect(slice[5] == 0);
}

// test