zig0

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

commit 7a90b5da8b4256d3908bbb0f0fe9148fa1cc32bc (tree)
parent aedca7da745e3cf425dc47e8077a6bee694122d8
Author: Motiejus Jakštys <motiejus.jakstys@chronosphere.io>
Date:   Tue, 10 Feb 2026 18:51:21 +0000

parser: port array literal hint and vertical alignment tests

Port tests:
- "array literal with hint"
- "array literal vertical column alignment"

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

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

diff --git a/parser_test.zig b/parser_test.zig @@ -2339,6 +2339,130 @@ test "zig fmt: struct literal containing a multiline expression" { ); } +test "zig fmt: array literal with hint" { + try testTransform( + \\const a = []u8{ + \\ 1, 2, // + \\ 3, + \\ 4, + \\ 5, + \\ 6, + \\ 7 }; + \\const a = []u8{ + \\ 1, 2, // + \\ 3, + \\ 4, + \\ 5, + \\ 6, + \\ 7, 8 }; + \\const a = []u8{ + \\ 1, 2, // + \\ 3, + \\ 4, + \\ 5, + \\ 6, // blah + \\ 7, 8 }; + \\const a = []u8{ + \\ 1, 2, // + \\ 3, // + \\ 4, + \\ 5, + \\ 6, + \\ 7 }; + \\const a = []u8{ + \\ 1, + \\ 2, + \\ 3, 4, // + \\ 5, 6, // + \\ 7, 8, // + \\}; + , + \\const a = []u8{ + \\ 1, 2, // + \\ 3, 4, + \\ 5, 6, + \\ 7, + \\}; + \\const a = []u8{ + \\ 1, 2, // + \\ 3, 4, + \\ 5, 6, + \\ 7, 8, + \\}; + \\const a = []u8{ + \\ 1, 2, // + \\ 3, 4, + \\ 5, + \\ 6, // blah + \\ 7, + \\ 8, + \\}; + \\const a = []u8{ + \\ 1, 2, // + \\ 3, // + \\ 4, + \\ 5, + \\ 6, + \\ 7, + \\}; + \\const a = []u8{ + \\ 1, + \\ 2, + \\ 3, 4, // + \\ 5, 6, // + \\ 7, 8, // + \\}; + \\ + ); +} + +test "zig fmt: array literal vertical column alignment" { + try testTransform( + \\const a = []u8{ + \\ 1000, 200, + \\ 30, 4, + \\ 50000, 60, + \\}; + \\const a = []u8{0, 1, 2, 3, 40, + \\ 4,5,600,7, + \\ 80, + \\ 9, 10, 11, 0, 13, 14, 15,}; + \\const a = [12]u8{ + \\ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + \\const a = [12]u8{ + \\ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, }; + \\ + , + \\const a = []u8{ + \\ 1000, 200, + \\ 30, 4, + \\ 50000, 60, + \\}; + \\const a = []u8{ + \\ 0, 1, 2, 3, 40, + \\ 4, 5, 600, 7, 80, + \\ 9, 10, 11, 0, 13, + \\ 14, 15, + \\}; + \\const a = [12]u8{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + \\const a = [12]u8{ + \\ 31, + \\ 28, + \\ 31, + \\ 30, + \\ 31, + \\ 30, + \\ 31, + \\ 31, + \\ 30, + \\ 31, + \\ 30, + \\ 31, + \\}; + \\ + ); +} + test "zig fmt: multiline string with backslash at end of line" { try testCanonical( \\comptime {