parser: update test bodies to match upstream verbatim
Update test content to match upstream exactly: - "block with same line comment after end brace" - "comments before var decl in struct" - "comments before global variables" - "comments in statements" - "comments before test decl" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2336,10 +2336,10 @@ test "zig fmt: nested blocks" {
|
||||
|
||||
test "zig fmt: block with same line comment after end brace" {
|
||||
try testCanonical(
|
||||
\\test {
|
||||
\\comptime {
|
||||
\\ {
|
||||
\\ const a = b;
|
||||
\\ } // end of block
|
||||
\\ b();
|
||||
\\ } // comment
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
@@ -2667,9 +2667,24 @@ test "zig fmt: comments before switch prong" {
|
||||
|
||||
test "zig fmt: comments before var decl in struct" {
|
||||
try testCanonical(
|
||||
\\const Foo = struct {
|
||||
\\ /// comment
|
||||
\\ bar: bool = true,
|
||||
\\pub const vfs_cap_data = extern struct {
|
||||
\\ // All of these are mandated as little endian
|
||||
\\ // when on disk.
|
||||
\\ const Data = struct {
|
||||
\\ permitted: u32,
|
||||
\\ inheritable: u32,
|
||||
\\ };
|
||||
\\
|
||||
\\ // in between
|
||||
\\
|
||||
\\ /// All of these are mandated as little endian
|
||||
\\ /// when on disk.
|
||||
\\ const Data = struct {
|
||||
\\ permitted: u32,
|
||||
\\ inheritable: u32,
|
||||
\\ };
|
||||
\\
|
||||
\\ // at end
|
||||
\\};
|
||||
\\
|
||||
);
|
||||
@@ -2684,20 +2699,23 @@ test "zig fmt: array literal with 1 item on 1 line" {
|
||||
|
||||
test "zig fmt: comments before global variables" {
|
||||
try testCanonical(
|
||||
\\/// comment
|
||||
\\var foo: i32 = undefined;
|
||||
\\/// Foo copies keys and values before they go into the map, and
|
||||
\\/// frees them when they get removed.
|
||||
\\pub const Foo = struct {};
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: comments in statements" {
|
||||
try testCanonical(
|
||||
\\comptime {
|
||||
\\ // a
|
||||
\\test "std" {
|
||||
\\ // statement comment
|
||||
\\ _ = @import("foo/bar.zig");
|
||||
\\
|
||||
\\ const x = 42; // b
|
||||
\\ // middle
|
||||
\\ // middle2
|
||||
\\
|
||||
\\ // c
|
||||
\\ // end
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
@@ -2705,9 +2723,13 @@ test "zig fmt: comments in statements" {
|
||||
|
||||
test "zig fmt: comments before test decl" {
|
||||
try testCanonical(
|
||||
\\/// top level doc comment
|
||||
\\// top level normal comment
|
||||
\\test "hi" {}
|
||||
\\
|
||||
\\// middle
|
||||
\\
|
||||
\\// end
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user