mirror of
https://github.com/ziglang/zig.git
synced 2026-01-06 13:33:21 +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
388 B
Zig
16 lines
388 B
Zig
const expect = @import("std").testing.expect;
|
|
|
|
test "@ptrCast from const to nullable" {
|
|
const c: u8 = 4;
|
|
var x: ?*const u8 = @ptrCast(?*const u8, &c);
|
|
expect(x.?.* == 4);
|
|
}
|
|
|
|
test "@ptrCast from var in empty struct to nullable" {
|
|
const container = struct {
|
|
var c: u8 = 4;
|
|
};
|
|
var x: ?*const u8 = @ptrCast(?*const u8, &container.c);
|
|
expect(x.?.* == 4);
|
|
}
|