| ... | @@ -87,7 +87,7 @@ test "zig fmt: empty file" { | ... | @@ -87,7 +87,7 @@ test "zig fmt: empty file" { |
| 87 | test "zig fmt: file ends in comment" { | 87 | test "zig fmt: file ends in comment" { |
| 88 | try testTransform( | 88 | try testTransform( |
| 89 | \\ //foobar | 89 | \\ //foobar |
| 90 | , | 90 | , |
| 91 | \\//foobar | 91 | \\//foobar |
| 92 | \\ | 92 | \\ |
| 93 | ); | 93 | ); |
| ... | @@ -2400,18 +2400,18 @@ test "zig fmt: comments before test decl" { | ... | @@ -2400,18 +2400,18 @@ test "zig fmt: comments before test decl" { |
| 2400 | } | 2400 | } |
| 2401 | | 2401 | |
| 2402 | test "zig fmt: preserve spacing" { | 2402 | test "zig fmt: preserve spacing" { |
| 2403 | try testCanonical( | 2403 | try testCanonical( |
| 2404 | \\const std = @import("std"); | 2404 | \\const std = @import("std"); |
| 2405 | \\ | 2405 | \\ |
| 2406 | \\pub fn main() !void { | 2406 | \\pub fn main() !void { |
| 2407 | \\ var stdout_file = std.io.getStdOut; | 2407 | \\ var stdout_file = std.io.getStdOut; |
| 2408 | \\ var stdout_file = std.io.getStdOut; | 2408 | \\ var stdout_file = std.io.getStdOut; |
| 2409 | \\ | 2409 | \\ |
| 2410 | \\ var stdout_file = std.io.getStdOut; | 2410 | \\ var stdout_file = std.io.getStdOut; |
| 2411 | \\ var stdout_file = std.io.getStdOut; | 2411 | \\ var stdout_file = std.io.getStdOut; |
| 2412 | \\} | 2412 | \\} |
| 2413 | \\ | 2413 | \\ |
| 2414 | ); | 2414 | ); |
| 2415 | } | 2415 | } |
| 2416 | | 2416 | |
| 2417 | //test "zig fmt: return types" { | 2417 | //test "zig fmt: return types" { |
| ... | @@ -2432,25 +2432,25 @@ test "zig fmt: imports" { | ... | @@ -2432,25 +2432,25 @@ test "zig fmt: imports" { |
| 2432 | } | 2432 | } |
| 2433 | | 2433 | |
| 2434 | test "zig fmt: global declarations" { | 2434 | test "zig fmt: global declarations" { |
| 2435 | try testCanonical( | 2435 | try testCanonical( |
| 2436 | \\const a = b; | 2436 | \\const a = b; |
| 2437 | \\pub const a = b; | 2437 | \\pub const a = b; |
| 2438 | \\var a = b; | 2438 | \\var a = b; |
| 2439 | \\pub var a = b; | 2439 | \\pub var a = b; |
| 2440 | \\const a: i32 = b; | 2440 | \\const a: i32 = b; |
| 2441 | \\pub const a: i32 = b; | 2441 | \\pub const a: i32 = b; |
| 2442 | \\var a: i32 = b; | 2442 | \\var a: i32 = b; |
| 2443 | \\pub var a: i32 = b; | 2443 | \\pub var a: i32 = b; |
| 2444 | \\extern const a: i32 = b; | 2444 | \\extern const a: i32 = b; |
| 2445 | \\pub extern const a: i32 = b; | 2445 | \\pub extern const a: i32 = b; |
| 2446 | \\extern var a: i32 = b; | 2446 | \\extern var a: i32 = b; |
| 2447 | \\pub extern var a: i32 = b; | 2447 | \\pub extern var a: i32 = b; |
| 2448 | \\extern "a" const a: i32 = b; | 2448 | \\extern "a" const a: i32 = b; |
| 2449 | \\pub extern "a" const a: i32 = b; | 2449 | \\pub extern "a" const a: i32 = b; |
| 2450 | \\extern "a" var a: i32 = b; | 2450 | \\extern "a" var a: i32 = b; |
| 2451 | \\pub extern "a" var a: i32 = b; | 2451 | \\pub extern "a" var a: i32 = b; |
| 2452 | \\ | 2452 | \\ |
| 2453 | ); | 2453 | ); |
| 2454 | } | 2454 | } |
| 2455 | | 2455 | |
| 2456 | test "zig fmt: extern declaration" { | 2456 | test "zig fmt: extern declaration" { |
| ... | @@ -2681,21 +2681,21 @@ test "zig fmt: functions" { | ... | @@ -2681,21 +2681,21 @@ test "zig fmt: functions" { |
| 2681 | } | 2681 | } |
| 2682 | | 2682 | |
| 2683 | test "zig fmt: multiline string" { | 2683 | test "zig fmt: multiline string" { |
| 2684 | try testCanonical( | 2684 | try testCanonical( |
| 2685 | \\test "" { | 2685 | \\test "" { |
| 2686 | \\ const s1 = | 2686 | \\ const s1 = |
| 2687 | \\ \\one | 2687 | \\ \\one |
| 2688 | \\ \\two) | 2688 | \\ \\two) |
| 2689 | \\ \\three | 2689 | \\ \\three |
| 2690 | \\ ; | 2690 | \\ ; |
| 2691 | \\ const s3 = // hi | 2691 | \\ const s3 = // hi |
| 2692 | \\ \\one | 2692 | \\ \\one |
| 2693 | \\ \\two) | 2693 | \\ \\two) |
| 2694 | \\ \\three | 2694 | \\ \\three |
| 2695 | \\ ; | 2695 | \\ ; |
| 2696 | \\} | 2696 | \\} |
| 2697 | \\ | 2697 | \\ |
| 2698 | ); | 2698 | ); |
| 2699 | } | 2699 | } |
| 2700 | | 2700 | |
| 2701 | test "zig fmt: values" { | 2701 | test "zig fmt: values" { |
| ... | @@ -3395,17 +3395,17 @@ test "zig fmt: file ends with struct field" { | ... | @@ -3395,17 +3395,17 @@ test "zig fmt: file ends with struct field" { |
| 3395 | } | 3395 | } |
| 3396 | | 3396 | |
| 3397 | test "zig fmt: comment after empty comment" { | 3397 | test "zig fmt: comment after empty comment" { |
| 3398 | try testTransform( | 3398 | try testTransform( |
| 3399 | \\const x = true; // | 3399 | \\const x = true; // |
| 3400 | \\// | 3400 | \\// |
| 3401 | \\// | 3401 | \\// |
| 3402 | \\//a | 3402 | \\//a |
| 3403 | \\ | 3403 | \\ |
| 3404 | , | 3404 | , |
| 3405 | \\const x = true; | 3405 | \\const x = true; |
| 3406 | \\//a | 3406 | \\//a |
| 3407 | \\ | 3407 | \\ |
| 3408 | ); | 3408 | ); |
| 3409 | } | 3409 | } |
| 3410 | | 3410 | |
| 3411 | //test "zig fmt: line comment in array" { | 3411 | //test "zig fmt: line comment in array" { |
| ... | @@ -3579,12 +3579,12 @@ test "zig fmt: comment after empty comment" { | ... | @@ -3579,12 +3579,12 @@ test "zig fmt: comment after empty comment" { |
| 3579 | //} | 3579 | //} |
| 3580 | | 3580 | |
| 3581 | test "zig fmt: extern without container keyword returns error" { | 3581 | test "zig fmt: extern without container keyword returns error" { |
| 3582 | try testError( | 3582 | try testError( |
| 3583 | \\const container = extern {}; | 3583 | \\const container = extern {}; |
| 3584 | \\ | 3584 | \\ |
| 3585 | , &[_]Error{ | 3585 | , &[_]Error{ |
| 3586 | .expected_container, | 3586 | .expected_container, |
| 3587 | }); | 3587 | }); |
| 3588 | } | 3588 | } |
| 3589 | | 3589 | |
| 3590 | test "zig fmt: same line doc comment returns error" { | 3590 | test "zig fmt: same line doc comment returns error" { |
| ... | @@ -3706,14 +3706,14 @@ test "zig fmt: C var args" { | ... | @@ -3706,14 +3706,14 @@ test "zig fmt: C var args" { |
| 3706 | //} | 3706 | //} |
| 3707 | | 3707 | |
| 3708 | test "zig fmt: Don't add extra newline after if" { | 3708 | test "zig fmt: Don't add extra newline after if" { |
| 3709 | try testCanonical( | 3709 | try testCanonical( |
| 3710 | \\pub fn atomicSymLink(allocator: *Allocator, existing_path: []const u8, new_path: []const u8) !void { | 3710 | \\pub fn atomicSymLink(allocator: *Allocator, existing_path: []const u8, new_path: []const u8) !void { |
| 3711 | \\ if (cwd().symLink(existing_path, new_path, .{})) { | 3711 | \\ if (cwd().symLink(existing_path, new_path, .{})) { |
| 3712 | \\ return; | 3712 | \\ return; |
| 3713 | \\ } | 3713 | \\ } |
| 3714 | \\} | 3714 | \\} |
| 3715 | \\ | 3715 | \\ |
| 3716 | ); | 3716 | ); |
| 3717 | } | 3717 | } |
| 3718 | | 3718 | |
| 3719 | //test "zig fmt: comments in ternary ifs" { | 3719 | //test "zig fmt: comments in ternary ifs" { |