authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-07-11 21:20:50+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-07-11 21:20:50+03:00
log1a989ba39dbf2b718df7cc9792b6abaac7f5986d
tree96499d37103186eea8c885af473268eebbac42cf
parente85fe13e44b1e2957b9d90e19c171fdfa8cb5505
signature Commit is signed but in an unrecognized format.

fix parser tests and add test for anytype conversion


1 files changed, 21 insertions(+), 5 deletions(-)

lib/std/zig/parser_test.zig+21-5
......@@ -422,10 +422,10 @@ test "zig fmt: asm expression with comptime content" {
422422 );
423423}
424424
425test "zig fmt: var struct field" {
425test "zig fmt: anytype struct field" {
426426 try testCanonical(
427427 \\pub const Pointer = struct {
428 \\ sentinel: var,
428 \\ sentinel: anytype,
429429 \\};
430430 \\
431431 );
......@@ -1932,7 +1932,7 @@ test "zig fmt: preserve spacing" {
19321932test "zig fmt: return types" {
19331933 try testCanonical(
19341934 \\pub fn main() !void {}
1935 \\pub fn main() var {}
1935 \\pub fn main() anytype {}
19361936 \\pub fn main() i32 {}
19371937 \\
19381938 );
......@@ -2140,9 +2140,9 @@ test "zig fmt: call expression" {
21402140 );
21412141}
21422142
2143test "zig fmt: var type" {
2143test "zig fmt: anytype type" {
21442144 try testCanonical(
2145 \\fn print(args: var) var {}
2145 \\fn print(args: anytype) anytype {}
21462146 \\
21472147 );
21482148}
......@@ -3180,6 +3180,22 @@ test "zig fmt: convert extern fn proto into callconv(.C)" {
31803180 );
31813181}
31823182
3183test "zig fmt: convert var to anytype" {
3184 // TODO remove in next release cycle
3185 try testTransform(
3186 \\pub fn main(
3187 \\ a: var,
3188 \\ bar: var,
3189 \\) void {}
3190 ,
3191 \\pub fn main(
3192 \\ a: anytype,
3193 \\ bar: anytype,
3194 \\) void {}
3195 \\
3196 );
3197}
3198
31833199const std = @import("std");
31843200const mem = std.mem;
31853201const warn = std.debug.warn;