Slices
1/1 test "basic slices"...index out of bounds
/deps/zig/docgen_tmp/test.zig:22:10: 0x204cc6 in test "basic slices" (test)
slice[10] += 1;
^
/deps/zig/lib/std/special/test_runner.zig:47:28: 0x22bc1e in std.special.main (test)
} else test_fn.func();
^
const result = root.main() catch |err| {
^
/deps/zig/lib/std/start.zig:123:5: 0x20548f in std.start._start (test)
@call(.{ .modifier = .never_inline }, posixCallMainAndExit, .{});
^
Tests failed. Use the following command to reproduce the failure:
This is one reason we prefer slices to pointers.
$ zig test slices.zig
2/2 test "slice pointer"...OK
All 2 tests passed.
See also:
null_terminated_slice.zig
$ zig test null_terminated_slice.zig
All 1 tests passed.