Slices
1/1 test "basic slices"... index out of bounds
/home/andy/Downloads/zig/docgen_tmp/test.zig:22:10: 0x205b06 in test "basic slices" (test)
slice[10] += 1;
^
/home/andy/Downloads/zig/lib/std/special/test_runner.zig:61:28: 0x22db51 in std.special.main (test)
} else test_fn.func();
^
const result = root.main() catch |err| {
^
/home/andy/Downloads/zig/lib/std/start.zig:162:5: 0x207192 in std.start._start (test)
@call(.{ .modifier = .never_inline }, posixCallMainAndExit, .{});
^
error: the following test command crashed:
docgen_tmp/zig-cache/o/2e7f715609483f0cd9100db66b70c1a0/test
This is one reason we prefer slices to pointers.
1/2 test "using slices for strings"... OK
All 2 tests passed.
See also:
null_terminated_slice.zig
$ zig test null_terminated_slice.zig
1/1 test "null terminated slice"... OK