mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
e3424332d3
* `doc/langref` formatting * upgrade `.{ .path = "..." }` to `b.path("...")` * avoid using arguments named `self` * make `Build.Step.Id` usage more consistent * add `Build.pathResolve` * use `pathJoin` and `pathResolve` everywhere * make sure `Build.LazyPath.getPath2` returns an absolute path
22 lines
553 B
Zig
22 lines
553 B
Zig
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
|
|
test "0-terminated sentinel array" {
|
|
const array = [_:0]u8{ 1, 2, 3, 4 };
|
|
|
|
try expect(@TypeOf(array) == [4:0]u8);
|
|
try expect(array.len == 4);
|
|
try expect(array[4] == 0);
|
|
}
|
|
|
|
test "extra 0s in 0-terminated sentinel array" {
|
|
// The sentinel value may appear earlier, but does not influence the compile-time 'len'.
|
|
const array = [_:0]u8{ 1, 0, 0, 4 };
|
|
|
|
try expect(@TypeOf(array) == [4:0]u8);
|
|
try expect(array.len == 4);
|
|
try expect(array[4] == 0);
|
|
}
|
|
|
|
// test
|