aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-10-28 17:05:17 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-10-28 17:05:17 -0700
commitc59ee3157f5a7fb5c6110422ea8215601285ea28 (patch)
tree6c241c1adb150f18ff109d5e14aba7d46bf90cb9 /test/behavior
parent9ed955e5ca755ddfa7ee4cb3c34f6373cb1bf6a8 (diff)
downloadzig-c59ee3157f5a7fb5c6110422ea8215601285ea28.tar.gz
zig-c59ee3157f5a7fb5c6110422ea8215601285ea28.zip
C backend: fix ptrtoint and wrap_errunion_err
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/if.zig15
-rw-r--r--test/behavior/if_llvm.zig18
2 files changed, 18 insertions, 15 deletions
diff --git a/test/behavior/if.zig b/test/behavior/if.zig
index e907f288de..a1f722d827 100644
--- a/test/behavior/if.zig
+++ b/test/behavior/if.zig
@@ -73,18 +73,3 @@ test "const result loc, runtime if cond, else unreachable" {
const x = if (t) Num.Two else unreachable;
try expect(x == .Two);
}
-
-test "if copies its payload" {
- const S = struct {
- fn doTheTest() !void {
- var tmp: ?i32 = 10;
- if (tmp) |value| {
- // Modify the original variable
- tmp = null;
- try expect(value == 10);
- } else unreachable;
- }
- };
- try S.doTheTest();
- comptime try S.doTheTest();
-}
diff --git a/test/behavior/if_llvm.zig b/test/behavior/if_llvm.zig
new file mode 100644
index 0000000000..e6773d90c0
--- /dev/null
+++ b/test/behavior/if_llvm.zig
@@ -0,0 +1,18 @@
+const std = @import("std");
+const expect = std.testing.expect;
+const expectEqual = std.testing.expectEqual;
+
+test "if copies its payload" {
+ const S = struct {
+ fn doTheTest() !void {
+ var tmp: ?i32 = 10;
+ if (tmp) |value| {
+ // Modify the original variable
+ tmp = null;
+ try expect(value == 10);
+ } else unreachable;
+ }
+ };
+ try S.doTheTest();
+ comptime try S.doTheTest();
+}