parser: port if-condition-wraps tests, implement catch payload
Port tests: - "if condition has line break but must not wrap" - "if condition has line break but must not wrap (no fn call comma)" Implement catch payload (|err|) parsing in parseExprPrecedence. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2009,6 +2009,51 @@ test "zig fmt: if condition wraps" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: if condition has line break but must not wrap" {
|
||||
try testCanonical(
|
||||
\\comptime {
|
||||
\\ if (self.user_input_options.put(
|
||||
\\ name,
|
||||
\\ UserInputOption{
|
||||
\\ .name = name,
|
||||
\\ .used = false,
|
||||
\\ },
|
||||
\\ ) catch unreachable) |*prev_value| {
|
||||
\\ foo();
|
||||
\\ bar();
|
||||
\\ }
|
||||
\\ if (put(
|
||||
\\ a,
|
||||
\\ b,
|
||||
\\ )) {
|
||||
\\ foo();
|
||||
\\ }
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: if condition has line break but must not wrap (no fn call comma)" {
|
||||
try testCanonical(
|
||||
\\comptime {
|
||||
\\ if (self.user_input_options.put(name, UserInputOption{
|
||||
\\ .name = name,
|
||||
\\ .used = false,
|
||||
\\ }) catch unreachable) |*prev_value| {
|
||||
\\ foo();
|
||||
\\ bar();
|
||||
\\ }
|
||||
\\ if (put(
|
||||
\\ a,
|
||||
\\ b,
|
||||
\\ )) {
|
||||
\\ foo();
|
||||
\\ }
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: pointer of unknown length" {
|
||||
try testCanonical(
|
||||
\\fn foo(ptr: [*]u8) void {}
|
||||
|
||||
Reference in New Issue
Block a user