zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 80b719d967d7241182e237b42ade1cd88494c8e8 (tree)
parent 58db3d27753709074fba7c88923754dd1c1a0ed9
Author: Isaac Freund <ifreund@ifreund.xyz>
Date:   Wed, 10 Feb 2021 13:02:37 +0100

zig fmt: fix typo in firstToken() for pointer types

Diffstat:
Mlib/std/zig/ast.zig | 4++--
Mlib/std/zig/parser_test.zig | 46+++++++++++++++++++++++-----------------------
2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/lib/std/zig/ast.zig b/lib/std/zig/ast.zig @@ -408,10 +408,10 @@ pub const Tree = struct { const main_token = main_tokens[n]; return switch (token_tags[main_token]) { .Asterisk => switch (token_tags[main_token - 1]) { - .LBrace => main_token - 1, + .LBracket => main_token - 1, else => main_token, }, - .LBrace => main_token, + .LBracket => main_token, else => unreachable, } - end_offset; }, diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig @@ -423,16 +423,16 @@ test "zig fmt: sentinel slice with modifiers" { ); } -//test "zig fmt: anon literal in array" { -// try testCanonical( -// \\var arr: [2]Foo = .{ -// \\ .{ .a = 2 }, -// \\ .{ .b = 3 }, -// \\}; -// \\ -// ); -//} -// +test "zig fmt: anon literal in array" { + try testCanonical( + \\var arr: [2]Foo = .{ + \\ .{ .a = 2 }, + \\ .{ .b = 3 }, + \\}; + \\ + ); +} + //test "zig fmt: alignment in anonymous literal" { // try testTransform( // \\const a = .{ @@ -751,12 +751,12 @@ test "zig fmt: tagged union with enum values" { ); } -//test "zig fmt: allowzero pointer" { -// try testCanonical( -// \\const T = [*]allowzero const u8; -// \\ -// ); -//} +test "zig fmt: allowzero pointer" { + try testCanonical( + \\const T = [*]allowzero const u8; + \\ + ); +} test "zig fmt: enum literal" { try testCanonical( @@ -806,13 +806,13 @@ test "zig fmt: character literal larger than u8" { // \\ // ); //} -// -//test "zig fmt: C pointers" { -// try testCanonical( -// \\const Ptr = [*c]i32; -// \\ -// ); -//} + +test "zig fmt: C pointers" { + try testCanonical( + \\const Ptr = [*c]i32; + \\ + ); +} test "zig fmt: threadlocal" { try testCanonical(