commit df10e2f885a795965913c10cfe6be1f5299786f3 (tree)
parent fdaeca84fe70cce739b241fcc15ed6dda6fb4905
Author: Motiejus Jakštys <motiejus@jakstys.lt>
Date: Tue, 10 Feb 2026 22:58:04 +0000
parser: reorder tests to match upstream file order
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat:
| M | parser_test.zig | | | 64 | +++++++++++++++++++++++++++++++++------------------------------- |
1 file changed, 33 insertions(+), 31 deletions(-)
diff --git a/parser_test.zig b/parser_test.zig
@@ -543,6 +543,7 @@ fn testCanonical(source: [:0]const u8) !void {
}
+
test "zig fmt: remove extra whitespace at start and end of file with comment between" {
try testTransform(
\\
@@ -2723,37 +2724,6 @@ test "zig fmt: nested struct literal with one item" {
);
}
-test "zig fmt: switch multiline string" {
- try testCanonical(
- \\test "switch multiline string" {
- \\ const x: u32 = 0;
- \\ const str = switch (x) {
- \\ 1 => "one",
- \\ 2 =>
- \\ \\ Comma after the multiline string
- \\ \\ is needed
- \\ ,
- \\ 3 => "three",
- \\ else => "else",
- \\ };
- \\
- \\ const Union = union(enum) {
- \\ Int: i64,
- \\ Float: f64,
- \\ };
- \\
- \\ const str = switch (u) {
- \\ Union.Int => |int|
- \\ \\ Comma after the multiline string
- \\ \\ is needed
- \\ ,
- \\ Union.Float => |*float| unreachable,
- \\ };
- \\}
- \\
- );
-}
-
test "zig fmt: switch cases trailing comma" {
try testTransform(
\\test "switch cases trailing comma"{
@@ -3778,6 +3748,37 @@ test "zig fmt: switch" {
);
}
+test "zig fmt: switch multiline string" {
+ try testCanonical(
+ \\test "switch multiline string" {
+ \\ const x: u32 = 0;
+ \\ const str = switch (x) {
+ \\ 1 => "one",
+ \\ 2 =>
+ \\ \\ Comma after the multiline string
+ \\ \\ is needed
+ \\ ,
+ \\ 3 => "three",
+ \\ else => "else",
+ \\ };
+ \\
+ \\ const Union = union(enum) {
+ \\ Int: i64,
+ \\ Float: f64,
+ \\ };
+ \\
+ \\ const str = switch (u) {
+ \\ Union.Int => |int|
+ \\ \\ Comma after the multiline string
+ \\ \\ is needed
+ \\ ,
+ \\ Union.Float => |*float| unreachable,
+ \\ };
+ \\}
+ \\
+ );
+}
+
test "zig fmt: while" {
try testCanonical(
\\test "while" {
@@ -4249,3 +4250,4 @@ test "my function" {
\\
);
}
+