| ... | ... | @@ -1,3 +1,38 @@ |
| 1 | test "zig fmt: line comment between if block and else keyword" { |
| 2 | try testTransform( |
| 3 | \\test "aoeu" { |
| 4 | \\ // cexp(finite|nan +- i inf|nan) = nan + i nan |
| 5 | \\ if ((hx & 0x7fffffff) != 0x7f800000) { |
| 6 | \\ return Complex(f32).new(y - y, y - y); |
| 7 | \\ } |
| 8 | \\ // cexp(-inf +- i inf|nan) = 0 + i0 |
| 9 | \\ else if (hx & 0x80000000 != 0) { |
| 10 | \\ return Complex(f32).new(0, 0); |
| 11 | \\ } |
| 12 | \\ // cexp(+inf +- i inf|nan) = inf + i nan |
| 13 | \\ // another comment |
| 14 | \\ else { |
| 15 | \\ return Complex(f32).new(x, y - y); |
| 16 | \\ } |
| 17 | \\} |
| 18 | , |
| 19 | \\test "aoeu" { |
| 20 | \\ // cexp(finite|nan +- i inf|nan) = nan + i nan |
| 21 | \\ if ((hx & 0x7fffffff) != 0x7f800000) { |
| 22 | \\ return Complex(f32).new(y - y, y - y); |
| 23 | \\ } // cexp(-inf +- i inf|nan) = 0 + i0 |
| 24 | \\ else if (hx & 0x80000000 != 0) { |
| 25 | \\ return Complex(f32).new(0, 0); |
| 26 | \\ } // cexp(+inf +- i inf|nan) = inf + i nan |
| 27 | \\ // another comment |
| 28 | \\ else { |
| 29 | \\ return Complex(f32).new(x, y - y); |
| 30 | \\ } |
| 31 | \\} |
| 32 | \\ |
| 33 | ); |
| 34 | } |
| 35 | |
| 1 | 36 | test "zig fmt: same line comments in expression" { |
| 2 | 37 | try testCanonical( |
| 3 | 38 | \\test "aoeu" { |
| ... | ... | @@ -9,38 +44,6 @@ test "zig fmt: same line comments in expression" { |
| 9 | 44 | ); |
| 10 | 45 | } |
| 11 | 46 | |
| 12 | | //test "zig fmt: line comment between if block and else keyword" { |
| 13 | | // try testTransform( |
| 14 | | // test "aoeu" { |
| 15 | | // // cexp(finite|nan +- i inf|nan) = nan + i nan |
| 16 | | // if ((hx & 0x7fffffff) != 0x7f800000) { |
| 17 | | // return Complex(f32).new(y - y, y - y); |
| 18 | | // } |
| 19 | | // // cexp(-inf +- i inf|nan) = 0 + i0 |
| 20 | | // else if (hx & 0x80000000 != 0) { |
| 21 | | // return Complex(f32).new(0, 0); |
| 22 | | // } |
| 23 | | // // cexp(+inf +- i inf|nan) = inf + i nan |
| 24 | | // else { |
| 25 | | // return Complex(f32).new(x, y - y); |
| 26 | | // } |
| 27 | | // } |
| 28 | | // , |
| 29 | | // test "aoeu" { |
| 30 | | // // cexp(finite|nan +- i inf|nan) = nan + i nan |
| 31 | | // if ((hx & 0x7fffffff) != 0x7f800000) { |
| 32 | | // return Complex(f32).new(y - y, y - y); |
| 33 | | // } // cexp(-inf +- i inf|nan) = 0 + i0 |
| 34 | | // else if (hx & 0x80000000 != 0) { |
| 35 | | // return Complex(f32).new(0, 0); |
| 36 | | // } // cexp(+inf +- i inf|nan) = inf + i nan |
| 37 | | // else { |
| 38 | | // return Complex(f32).new(x, y - y); |
| 39 | | // } |
| 40 | | // } |
| 41 | | // ); |
| 42 | | //} |
| 43 | | |
| 44 | 47 | test "zig fmt: add comma on last switch prong" { |
| 45 | 48 | try testTransform( |
| 46 | 49 | \\test "aoeu" { |