mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
add test coverage for fixed bug. closes #5518
This commit is contained in:
parent
e778e47140
commit
ec4cd87ed7
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user