zig/test/behavior/bugs/1607.zig
Andrew Kelley 4307436b99 move behavior tests from test/stage1/ to test/
And fix test cases to make them pass. This is in preparation for
starting to pass behavior tests with self-hosted.
2021-04-29 15:54:04 -07:00

16 lines
309 B
Zig

const std = @import("std");
const testing = std.testing;
const a = [_]u8{ 1, 2, 3 };
fn checkAddress(s: []const u8) void {
for (s) |*i, j| {
testing.expect(i == &a[j]);
}
}
test "slices pointing at the same address as global array." {
checkAddress(&a);
comptime checkAddress(&a);
}