aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/try.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-02-22 14:15:09 +0100
committerJakub Konka <kubkon@jakubkonka.com>2022-02-22 21:57:42 +0100
commit25e4b16e25502ca5e76e4049ed9f727168782dde (patch)
tree947799ee1d22e621937c95842370cc7aee679412 /test/behavior/try.zig
parenta94267b2906e90aadf397b3f524e1069721fb496 (diff)
downloadzig-25e4b16e25502ca5e76e4049ed9f727168782dde.tar.gz
zig-25e4b16e25502ca5e76e4049ed9f727168782dde.zip
Port more behavior tests
Diffstat (limited to 'test/behavior/try.zig')
-rw-r--r--test/behavior/try.zig14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/behavior/try.zig b/test/behavior/try.zig
index 029d946588..cd8b03afab 100644
--- a/test/behavior/try.zig
+++ b/test/behavior/try.zig
@@ -1,6 +1,12 @@
-const expect = @import("std").testing.expect;
+const std = @import("std");
+const builtin = @import("builtin");
+const expect = std.testing.expect;
test "try on error union" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
+
try tryOnErrorUnionImpl();
comptime try tryOnErrorUnionImpl();
}
@@ -19,6 +25,9 @@ fn returnsTen() anyerror!i32 {
}
test "try without vars" {
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
+
const result1 = if (failIfTrue(true)) 1 else |_| @as(i32, 2);
try expect(result1 == 2);
@@ -35,6 +44,9 @@ fn failIfTrue(ok: bool) anyerror!void {
}
test "try then not executed with assignment" {
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
+
if (failIfTrue(true)) {
unreachable;
} else |err| {