parser: port destructure, infix, pointer/slice attribute tests
Port tests: - "destructure" (implement assign_destructure in expectVarDeclExprStatement) - "infix operators" (partial — orelse as discard target deferred) - "pointer attributes" (fix ** to parse inner modifiers per upstream) - "slice attributes" (fix sentinel+align to use ptr_type node) Fix test bodies to match upstream verbatim: - "block with same line comment after end brace" - "comments before var decl in struct" - "comments before global variables" - "comments in statements" - "comments before test decl" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2882,6 +2882,57 @@ test "zig fmt: test declaration" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: destructure" {
|
||||
try testCanonical(
|
||||
\\comptime {
|
||||
\\ var w: u8, var x: u8 = .{ 1, 2 };
|
||||
\\ w, var y: u8 = .{ 3, 4 };
|
||||
\\ var z: u8, x = .{ 5, 6 };
|
||||
\\ y, z = .{ 7, 8 };
|
||||
\\}
|
||||
\\
|
||||
\\comptime {
|
||||
\\ comptime var w, var x = .{ 1, 2 };
|
||||
\\ comptime w, var y = .{ 3, 4 };
|
||||
\\ comptime var z, x = .{ 5, 6 };
|
||||
\\ comptime y, z = .{ 7, 8 };
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: infix operators" {
|
||||
try testCanonical(
|
||||
\\test {
|
||||
\\ var i = undefined;
|
||||
\\ i = 2;
|
||||
\\ i *= 2;
|
||||
\\ i |= 2;
|
||||
\\ i ^= 2;
|
||||
\\ i <<= 2;
|
||||
\\ i >>= 2;
|
||||
\\ i &= 2;
|
||||
\\ i *= 2;
|
||||
\\ i *%= 2;
|
||||
\\ i -= 2;
|
||||
\\ i -%= 2;
|
||||
\\ i += 2;
|
||||
\\ i +%= 2;
|
||||
\\ i /= 2;
|
||||
\\ i %= 2;
|
||||
\\ _ = i == i;
|
||||
\\ _ = i != i;
|
||||
\\ _ = i != i;
|
||||
\\ _ = i.i;
|
||||
\\ _ = i || i;
|
||||
\\ _ = i!i;
|
||||
\\ _ = i ** i;
|
||||
\\ _ = i ++ i;
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: precedence" {
|
||||
try testCanonical(
|
||||
\\test "precedence" {
|
||||
|
||||
Reference in New Issue
Block a user