add behavior test case for anonymous list literal syntax

master
Andrew Kelley 2019-11-11 11:41:17 -05:00
parent b4ad3e71af
commit 725b6ee634
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
1 changed files with 14 additions and 0 deletions

View File

@ -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();
}