diff options
Diffstat (limited to 'test/behavior')
| -rw-r--r-- | test/behavior/cast.zig | 1 | ||||
| -rw-r--r-- | test/behavior/eval.zig | 12 | ||||
| -rw-r--r-- | test/behavior/fn.zig | 17 |
3 files changed, 29 insertions, 1 deletions
diff --git a/test/behavior/cast.zig b/test/behavior/cast.zig index bdff7c4de4..fc364da0b8 100644 --- a/test/behavior/cast.zig +++ b/test/behavior/cast.zig @@ -401,7 +401,6 @@ test "expected [*c]const u8, found [*:0]const u8" { } test "explicit cast from integer to error type" { - if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO diff --git a/test/behavior/eval.zig b/test/behavior/eval.zig index 302de93591..0b3cf0771a 100644 --- a/test/behavior/eval.zig +++ b/test/behavior/eval.zig @@ -1649,3 +1649,15 @@ test "early exit in container level const" { }; try expect(S.value == 1); } + +test "@inComptime" { + const S = struct { + fn inComptime() bool { + return @inComptime(); + } + }; + try expectEqual(false, @inComptime()); + try expectEqual(true, comptime @inComptime()); + try expectEqual(false, S.inComptime()); + try expectEqual(true, comptime S.inComptime()); +} diff --git a/test/behavior/fn.zig b/test/behavior/fn.zig index e854764649..0dba59f92f 100644 --- a/test/behavior/fn.zig +++ b/test/behavior/fn.zig @@ -455,6 +455,23 @@ test "method call with optional and error union first param" { try s.errUnion(); } +test "method call with optional pointer first param" { + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO + + const S = struct { + x: i32 = 1234, + + fn method(s: ?*@This()) !void { + try expect(s.?.x == 1234); + } + }; + var s: S = .{}; + try s.method(); + const s_ptr = &s; + try s_ptr.method(); +} + test "using @ptrCast on function pointers" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
