authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-02-22 17:37:17+01:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-02-22 17:37:17+01:00
log34c08a91d59a521f81ec5d4d4ee58a73038c286f
treef2ee7c6154230d695c154696b314eb76c39a8c3d
parent928790364ab486de240b8c14ef5ef312079377d7
signaturelock-open Commit is signed but in an unrecognized format.

zig fmt: fix formatting of parser tests


1 files changed, 72 insertions(+), 72 deletions(-)

lib/std/zig/parser_test.zig+72-72
......@@ -87,7 +87,7 @@ test "zig fmt: empty file" {
8787test "zig fmt: file ends in comment" {
8888 try testTransform(
8989 \\ //foobar
90 ,
90 ,
9191 \\//foobar
9292 \\
9393 );
......@@ -2400,18 +2400,18 @@ test "zig fmt: comments before test decl" {
24002400}
24012401
24022402test "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 );
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 );
24152415}
24162416
24172417//test "zig fmt: return types" {
......@@ -2432,25 +2432,25 @@ test "zig fmt: imports" {
24322432}
24332433
24342434test "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 );
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 );
24542454}
24552455
24562456test "zig fmt: extern declaration" {
......@@ -2681,21 +2681,21 @@ test "zig fmt: functions" {
26812681}
26822682
26832683test "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 );
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 );
26992699}
27002700
27012701test "zig fmt: values" {
......@@ -3395,17 +3395,17 @@ test "zig fmt: file ends with struct field" {
33953395}
33963396
33973397test "zig fmt: comment after empty comment" {
3398 try testTransform(
3399 \\const x = true; //
3400 \\//
3401 \\//
3402 \\//a
3403 \\
3404 ,
3405 \\const x = true;
3406 \\//a
3407 \\
3408 );
3398 try testTransform(
3399 \\const x = true; //
3400 \\//
3401 \\//
3402 \\//a
3403 \\
3404 ,
3405 \\const x = true;
3406 \\//a
3407 \\
3408 );
34093409}
34103410
34113411//test "zig fmt: line comment in array" {
......@@ -3579,12 +3579,12 @@ test "zig fmt: comment after empty comment" {
35793579//}
35803580
35813581test "zig fmt: extern without container keyword returns error" {
3582 try testError(
3583 \\const container = extern {};
3584 \\
3585 , &[_]Error{
3586 .expected_container,
3587 });
3582 try testError(
3583 \\const container = extern {};
3584 \\
3585 , &[_]Error{
3586 .expected_container,
3587 });
35883588}
35893589
35903590test "zig fmt: same line doc comment returns error" {
......@@ -3706,14 +3706,14 @@ test "zig fmt: C var args" {
37063706//}
37073707
37083708test "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 );
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 );
37173717}
37183718
37193719//test "zig fmt: comments in ternary ifs" {