add test coverage for fixed bug. closes #5518

This commit is contained in:
Andrew Kelley 2023-02-19 18:10:13 -07:00
parent e778e47140
commit ec4cd87ed7

View File

@ -1143,3 +1143,17 @@ test "orelse coercion as function argument" {
var foo = Container.init(optional orelse .{});
try expect(foo.a.?.start == -1);
}
test "runtime-known globals initialized with undefined" {
const S = struct {
var array: [10]u32 = [_]u32{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var vp: [*]u32 = undefined;
var s: []u32 = undefined;
};
S.vp = &S.array;
S.s = S.vp[0..5];
try expect(S.s[0] == 1);
try expect(S.s[4] == 5);
}