aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/basic.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/behavior/basic.zig')
-rw-r--r--test/behavior/basic.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig
index ae4cb26354..f3d511916f 100644
--- a/test/behavior/basic.zig
+++ b/test/behavior/basic.zig
@@ -2,6 +2,7 @@ const std = @import("std");
const builtin = @import("builtin");
const mem = std.mem;
const expect = std.testing.expect;
+const expectEqualStrings = std.testing.expectEqualStrings;
// normal comment
@@ -446,3 +447,15 @@ test "self reference through fn ptr field" {
a.f = S.foo;
try expect(a.f(a) == 12);
}
+
+test "global variable initialized to global variable array element" {
+ try expect(global_ptr == &gdt[0]);
+}
+const GDTEntry = struct {
+ field: i32,
+};
+var gdt = [_]GDTEntry{
+ GDTEntry{ .field = 1 },
+ GDTEntry{ .field = 2 },
+};
+var global_ptr = &gdt[0];