From 725b6ee634f01355da4a6badc5675751b85f0bf0 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 11 Nov 2019 11:41:17 -0500 Subject: [PATCH] add behavior test case for anonymous list literal syntax --- test/stage1/behavior/array.zig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/stage1/behavior/array.zig b/test/stage1/behavior/array.zig index f9ca1efdb9..0558a47fa4 100644 --- a/test/stage1/behavior/array.zig +++ b/test/stage1/behavior/array.zig @@ -298,3 +298,17 @@ test "implicit cast zero sized array ptr to slice" { const c: []const u8 = &b; expect(c.len == 0); } + +test "anonymous list literal syntax" { + const S = struct { + fn doTheTest() void { + var array: [4]u8 = .{1, 2, 3, 4}; + expect(array[0] == 1); + expect(array[1] == 2); + expect(array[2] == 3); + expect(array[3] == 4); + } + }; + S.doTheTest(); + comptime S.doTheTest(); +}