aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/pointers.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-05-16 20:44:40 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-05-17 23:50:38 -0700
commit95f5e17e49d32a301d6a9d6f9948719d65469b09 (patch)
treecf0457ec85038f2133ffbc7075e0ccf82d0ec7d1 /test/behavior/pointers.zig
parent00f3d84f38c54e70716cf8e2908c899b49de1d88 (diff)
downloadzig-95f5e17e49d32a301d6a9d6f9948719d65469b09.tar.gz
zig-95f5e17e49d32a301d6a9d6f9948719d65469b09.zip
behavior tests: correction of C pointer test
This test was also covering this behavior: ```zig test "equality of pointers to comptime const" { const a: i32 = undefined; comptime assert(&a == &a); } ``` This check belongs in its own behavior test which isolates this behavior; not bundled along with a C pointer test.
Diffstat (limited to 'test/behavior/pointers.zig')
-rw-r--r--test/behavior/pointers.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/behavior/pointers.zig b/test/behavior/pointers.zig
index 5b9c3c8cf0..42939986d4 100644
--- a/test/behavior/pointers.zig
+++ b/test/behavior/pointers.zig
@@ -214,7 +214,10 @@ test "allowzero pointer and slice" {
}
test "assign null directly to C pointer and test null equality" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
var x: [*c]i32 = null;
try expect(x == null);
@@ -238,7 +241,8 @@ test "assign null directly to C pointer and test null equality" {
@panic("fail");
}
const othery: i32 = undefined;
- comptime try expect((y orelse &othery) == &othery);
+ const ptr_othery = &othery;
+ comptime try expect((y orelse ptr_othery) == ptr_othery);
var n: i32 = 1234;
var x1: [*c]i32 = &n;