parser: port array/slice literal and pointer type tests
- "sentinel array literal 1 element" - "anon literal in array" - "Unicode code point literal larger than u8" - "slices with spaces in bounds" - "C pointers" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1817,6 +1817,53 @@ test "zig fmt: c pointer type" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: sentinel array literal 1 element" {
|
||||
try testCanonical(
|
||||
\\test {
|
||||
\\ const x = [_:9000]u32{a};
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: anon literal in array" {
|
||||
try testCanonical(
|
||||
\\var arr: [2]Foo = .{
|
||||
\\ .{ .a = 2 },
|
||||
\\ .{ .b = 3 },
|
||||
\\};
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: Unicode code point literal larger than u8" {
|
||||
try testCanonical(
|
||||
\\test {
|
||||
\\ const x = X{
|
||||
\\ .a = b,
|
||||
\\ };
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: slices with spaces in bounds" {
|
||||
try testCanonical(
|
||||
\\const a = b[0 + 0 ..];
|
||||
\\const c = d[0 + 0 .. 1];
|
||||
\\const c = d[0 + 0 .. :0];
|
||||
\\const e = f[0 .. 1 + 1 :0];
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: C pointers" {
|
||||
try testCanonical(
|
||||
\\const Ptr = [*c]i32;
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: sentinel-terminated array type" {
|
||||
try testCanonical(
|
||||
\\pub fn cStrToPrefixedFileW(s: [*:0]const u8) ![PATH_MAX_WIDE:0]u16 {
|
||||
|
||||
Reference in New Issue
Block a user