| ... | ... | @@ -2399,20 +2399,20 @@ test "zig fmt: comments before test decl" { |
| 2399 | 2399 | ); |
| 2400 | 2400 | } |
| 2401 | 2401 | |
| 2402 | | //test "zig fmt: preserve spacing" { |
| 2403 | | // try testCanonical( |
| 2404 | | // \\const std = @import("std"); |
| 2405 | | // \\ |
| 2406 | | // \\pub fn main() !void { |
| 2407 | | // \\ var stdout_file = std.io.getStdOut; |
| 2408 | | // \\ var stdout_file = std.io.getStdOut; |
| 2409 | | // \\ |
| 2410 | | // \\ var stdout_file = std.io.getStdOut; |
| 2411 | | // \\ var stdout_file = std.io.getStdOut; |
| 2412 | | // \\} |
| 2413 | | // \\ |
| 2414 | | // ); |
| 2415 | | //} |
| 2402 | test "zig fmt: preserve spacing" { |
| 2403 | try testCanonical( |
| 2404 | \\const std = @import("std"); |
| 2405 | \\ |
| 2406 | \\pub fn main() !void { |
| 2407 | \\ var stdout_file = std.io.getStdOut; |
| 2408 | \\ var stdout_file = std.io.getStdOut; |
| 2409 | \\ |
| 2410 | \\ var stdout_file = std.io.getStdOut; |
| 2411 | \\ var stdout_file = std.io.getStdOut; |
| 2412 | \\} |
| 2413 | \\ |
| 2414 | ); |
| 2415 | } |
| 2416 | 2416 | |
| 2417 | 2417 | //test "zig fmt: return types" { |
| 2418 | 2418 | // try testCanonical( |
| ... | ... | @@ -2431,27 +2431,27 @@ test "zig fmt: imports" { |
| 2431 | 2431 | ); |
| 2432 | 2432 | } |
| 2433 | 2433 | |
| 2434 | | //test "zig fmt: global declarations" { |
| 2435 | | // try testCanonical( |
| 2436 | | // \\const a = b; |
| 2437 | | // \\pub const a = b; |
| 2438 | | // \\var a = b; |
| 2439 | | // \\pub var a = b; |
| 2440 | | // \\const a: i32 = b; |
| 2441 | | // \\pub const a: i32 = b; |
| 2442 | | // \\var a: i32 = b; |
| 2443 | | // \\pub var a: i32 = b; |
| 2444 | | // \\extern const a: i32 = b; |
| 2445 | | // \\pub extern const a: i32 = b; |
| 2446 | | // \\extern var a: i32 = b; |
| 2447 | | // \\pub extern var a: i32 = b; |
| 2448 | | // \\extern "a" const a: i32 = b; |
| 2449 | | // \\pub extern "a" const a: i32 = b; |
| 2450 | | // \\extern "a" var a: i32 = b; |
| 2451 | | // \\pub extern "a" var a: i32 = b; |
| 2452 | | // \\ |
| 2453 | | // ); |
| 2454 | | //} |
| 2434 | test "zig fmt: global declarations" { |
| 2435 | try testCanonical( |
| 2436 | \\const a = b; |
| 2437 | \\pub const a = b; |
| 2438 | \\var a = b; |
| 2439 | \\pub var a = b; |
| 2440 | \\const a: i32 = b; |
| 2441 | \\pub const a: i32 = b; |
| 2442 | \\var a: i32 = b; |
| 2443 | \\pub var a: i32 = b; |
| 2444 | \\extern const a: i32 = b; |
| 2445 | \\pub extern const a: i32 = b; |
| 2446 | \\extern var a: i32 = b; |
| 2447 | \\pub extern var a: i32 = b; |
| 2448 | \\extern "a" const a: i32 = b; |
| 2449 | \\pub extern "a" const a: i32 = b; |
| 2450 | \\extern "a" var a: i32 = b; |
| 2451 | \\pub extern "a" var a: i32 = b; |
| 2452 | \\ |
| 2453 | ); |
| 2454 | } |
| 2455 | 2455 | |
| 2456 | 2456 | test "zig fmt: extern declaration" { |
| 2457 | 2457 | try testCanonical( |
| ... | ... | @@ -2680,23 +2680,23 @@ test "zig fmt: functions" { |
| 2680 | 2680 | ); |
| 2681 | 2681 | } |
| 2682 | 2682 | |
| 2683 | | //test "zig fmt: multiline string" { |
| 2684 | | // try testCanonical( |
| 2685 | | // \\test "" { |
| 2686 | | // \\ const s1 = |
| 2687 | | // \\ \\one |
| 2688 | | // \\ \\two) |
| 2689 | | // \\ \\three |
| 2690 | | // \\ ; |
| 2691 | | // \\ const s3 = // hi |
| 2692 | | // \\ \\one |
| 2693 | | // \\ \\two) |
| 2694 | | // \\ \\three |
| 2695 | | // \\ ; |
| 2696 | | // \\} |
| 2697 | | // \\ |
| 2698 | | // ); |
| 2699 | | //} |
| 2683 | test "zig fmt: multiline string" { |
| 2684 | try testCanonical( |
| 2685 | \\test "" { |
| 2686 | \\ const s1 = |
| 2687 | \\ \\one |
| 2688 | \\ \\two) |
| 2689 | \\ \\three |
| 2690 | \\ ; |
| 2691 | \\ const s3 = // hi |
| 2692 | \\ \\one |
| 2693 | \\ \\two) |
| 2694 | \\ \\three |
| 2695 | \\ ; |
| 2696 | \\} |
| 2697 | \\ |
| 2698 | ); |
| 2699 | } |
| 2700 | 2700 | |
| 2701 | 2701 | test "zig fmt: values" { |
| 2702 | 2702 | try testCanonical( |
| ... | ... | @@ -3578,15 +3578,14 @@ test "zig fmt: comment after empty comment" { |
| 3578 | 3578 | // ); |
| 3579 | 3579 | //} |
| 3580 | 3580 | |
| 3581 | | //test "zig fmt: extern without container keyword returns error" { |
| 3582 | | // try testError( |
| 3583 | | // \\const container = extern {}; |
| 3584 | | // \\ |
| 3585 | | // , &[_]Error{ |
| 3586 | | // .expected_expr, |
| 3587 | | // .expected_var_decl_or_fn, |
| 3588 | | // }); |
| 3589 | | //} |
| 3581 | test "zig fmt: extern without container keyword returns error" { |
| 3582 | try testError( |
| 3583 | \\const container = extern {}; |
| 3584 | \\ |
| 3585 | , &[_]Error{ |
| 3586 | .expected_container, |
| 3587 | }); |
| 3588 | } |
| 3590 | 3589 | |
| 3591 | 3590 | test "zig fmt: same line doc comment returns error" { |
| 3592 | 3591 | try testError( |
| ... | ... | @@ -3706,16 +3705,16 @@ test "zig fmt: C var args" { |
| 3706 | 3705 | // ); |
| 3707 | 3706 | //} |
| 3708 | 3707 | |
| 3709 | | //test "zig fmt: Don't add extra newline after if" { |
| 3710 | | // try testCanonical( |
| 3711 | | // \\pub fn atomicSymLink(allocator: *Allocator, existing_path: []const u8, new_path: []const u8) !void { |
| 3712 | | // \\ if (cwd().symLink(existing_path, new_path, .{})) { |
| 3713 | | // \\ return; |
| 3714 | | // \\ } |
| 3715 | | // \\} |
| 3716 | | // \\ |
| 3717 | | // ); |
| 3718 | | //} |
| 3708 | test "zig fmt: Don't add extra newline after if" { |
| 3709 | try testCanonical( |
| 3710 | \\pub fn atomicSymLink(allocator: *Allocator, existing_path: []const u8, new_path: []const u8) !void { |
| 3711 | \\ if (cwd().symLink(existing_path, new_path, .{})) { |
| 3712 | \\ return; |
| 3713 | \\ } |
| 3714 | \\} |
| 3715 | \\ |
| 3716 | ); |
| 3717 | } |
| 3719 | 3718 | |
| 3720 | 3719 | //test "zig fmt: comments in ternary ifs" { |
| 3721 | 3720 | // try testCanonical( |