mirror of
https://github.com/ziglang/zig.git
synced 2026-01-09 08:55:36 +00:00
And fix test cases to make them pass. This is in preparation for starting to pass behavior tests with self-hosted.
16 lines
309 B
Zig
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);
|
|
}
|