zig0

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

commit 955df90c723859efb4a836d0b511f64dea294ab6 (tree)
parent b7e7befc1e23168f07a486fd2b223da05bec1560
Author: Motiejus Jakštys <motiejus.jakstys@chronosphere.io>
Date:   Tue, 10 Feb 2026 18:13:32 +0000

parser: port alignment and zig fmt whitespace tests

Port tests:
- "alignment in anonymous literal"
- "'zig fmt: (off|on)' can be surrounded by arbitrary whitespace"

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

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

diff --git a/parser_test.zig b/parser_test.zig @@ -2145,6 +2145,43 @@ test "zig fmt: anytype type" { ); } +test "zig fmt: alignment in anonymous literal" { + try testTransform( + \\const a = .{ + \\ "U", "L", "F", + \\ "U'", + \\ "L'", + \\ "F'", + \\}; + \\ + , + \\const a = .{ + \\ "U", "L", "F", + \\ "U'", "L'", "F'", + \\}; + \\ + ); +} + +test "zig fmt: 'zig fmt: (off|on)' can be surrounded by arbitrary whitespace" { + try testTransform( + \\// Test trailing comma syntax + \\// zig fmt: off + \\ + \\const struct_trailing_comma = struct { x: i32, y: i32, }; + \\ + \\// zig fmt: on + , + \\// Test trailing comma syntax + \\// zig fmt: off + \\ + \\const struct_trailing_comma = struct { x: i32, y: i32, }; + \\ + \\// zig fmt: on + \\ + ); +} + test "zig fmt: line and doc comment following 'zig fmt: off'" { try testCanonical( \\// zig fmt: off