fix parser tests and add test for anytype conversion
This commit is contained in:
parent
e85fe13e44
commit
1a989ba39d
@ -422,10 +422,10 @@ test "zig fmt: asm expression with comptime content" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: var struct field" {
|
||||
test "zig fmt: anytype struct field" {
|
||||
try testCanonical(
|
||||
\\pub const Pointer = struct {
|
||||
\\ sentinel: var,
|
||||
\\ sentinel: anytype,
|
||||
\\};
|
||||
\\
|
||||
);
|
||||
@ -1932,7 +1932,7 @@ test "zig fmt: preserve spacing" {
|
||||
test "zig fmt: return types" {
|
||||
try testCanonical(
|
||||
\\pub fn main() !void {}
|
||||
\\pub fn main() var {}
|
||||
\\pub fn main() anytype {}
|
||||
\\pub fn main() i32 {}
|
||||
\\
|
||||
);
|
||||
@ -2140,9 +2140,9 @@ test "zig fmt: call expression" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: var type" {
|
||||
test "zig fmt: anytype type" {
|
||||
try testCanonical(
|
||||
\\fn print(args: var) var {}
|
||||
\\fn print(args: anytype) anytype {}
|
||||
\\
|
||||
);
|
||||
}
|
||||
@ -3180,6 +3180,22 @@ test "zig fmt: convert extern fn proto into callconv(.C)" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: convert var to anytype" {
|
||||
// TODO remove in next release cycle
|
||||
try testTransform(
|
||||
\\pub fn main(
|
||||
\\ a: var,
|
||||
\\ bar: var,
|
||||
\\) void {}
|
||||
,
|
||||
\\pub fn main(
|
||||
\\ a: anytype,
|
||||
\\ bar: anytype,
|
||||
\\) void {}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
const std = @import("std");
|
||||
const mem = std.mem;
|
||||
const warn = std.debug.warn;
|
||||
|
Loading…
x
Reference in New Issue
Block a user