zig0

my attempts at zig bootstrapping in C
Log | Files | Refs | README | LICENSE

commit 515fb92613fbe2a7e84898e5080a18c2ff793fee (tree)
parent 6b38ea04a88deb96c362513f415d41cf286f15ed
Author: Motiejus Jakštys <motiejus.jakstys@chronosphere.io>
Date:   Tue, 10 Feb 2026 17:24:56 +0000

parser: port array/slice literal and pointer type tests

- "sentinel array literal 1 element"
- "anon literal in array"
- "Unicode code point literal larger than u8"
- "slices with spaces in bounds"
- "C pointers"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Diffstat:
Mparser_test.zig | 47+++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+), 0 deletions(-)

diff --git a/parser_test.zig b/parser_test.zig @@ -1817,6 +1817,53 @@ test "zig fmt: c pointer type" { ); } +test "zig fmt: sentinel array literal 1 element" { + try testCanonical( + \\test { + \\ const x = [_:9000]u32{a}; + \\} + \\ + ); +} + +test "zig fmt: anon literal in array" { + try testCanonical( + \\var arr: [2]Foo = .{ + \\ .{ .a = 2 }, + \\ .{ .b = 3 }, + \\}; + \\ + ); +} + +test "zig fmt: Unicode code point literal larger than u8" { + try testCanonical( + \\test { + \\ const x = X{ + \\ .a = b, + \\ }; + \\} + \\ + ); +} + +test "zig fmt: slices with spaces in bounds" { + try testCanonical( + \\const a = b[0 + 0 ..]; + \\const c = d[0 + 0 .. 1]; + \\const c = d[0 + 0 .. :0]; + \\const e = f[0 .. 1 + 1 :0]; + \\ + ); +} + +test "zig fmt: C pointers" { + try testCanonical( + \\const Ptr = [*c]i32; + \\ + ); +} + test "zig fmt: sentinel-terminated array type" { try testCanonical( \\pub fn cStrToPrefixedFileW(s: [*:0]const u8) ![PATH_MAX_WIDE:0]u16 {