commit 1a989ba39dbf2b718df7cc9792b6abaac7f5986d (tree)
parent e85fe13e44b1e2957b9d90e19c171fdfa8cb5505
Author: Vexu <git@vexu.eu>
Date: Sat, 11 Jul 2020 21:20:50 +0300
fix parser tests and add test for anytype conversion
Diffstat:
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig
@@ -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;