diff options
| author | Timon Kruiper <timonkruiper@gmail.com> | 2021-03-24 15:41:32 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-03-24 19:54:03 -0700 |
| commit | ea42ab34abc0408b66ce2c0212afd4f5705e8d43 (patch) | |
| tree | 54ddd2108451aa314802e35b0873d4e3ab8ecdab | |
| parent | 522707622e95ef17b94c7a3d78ca81cadde5274d (diff) | |
| download | zig-ea42ab34abc0408b66ce2c0212afd4f5705e8d43.tar.gz zig-ea42ab34abc0408b66ce2c0212afd4f5705e8d43.zip | |
stage2: add block test cases llvm backend
| -rw-r--r-- | test/stage2/llvm.zig | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/test/stage2/llvm.zig b/test/stage2/llvm.zig index 1ad1293665..8ac9f2747f 100644 --- a/test/stage2/llvm.zig +++ b/test/stage2/llvm.zig @@ -60,57 +60,57 @@ pub fn addCases(ctx: *TestContext) !void { , ""); } - //{ - // var case = ctx.exeUsingLlvmBackend("blocks", linux_x64); + { + var case = ctx.exeUsingLlvmBackend("blocks", linux_x64); - // case.addCompareOutput( - // \\fn assert(ok: bool) void { - // \\ if (!ok) unreachable; - // \\} - // \\ - // \\fn foo(ok: bool) i32 { - // \\ const val: i32 = blk: { - // \\ var x: i32 = 1; - // \\ if (!ok) break :blk x + 9; - // \\ break :blk x + 19; - // \\ }; - // \\ return val + 10; - // \\} - // \\ - // \\export fn main() c_int { - // \\ assert(foo(false) == 20); - // \\ assert(foo(true) == 30); - // \\ return 0; - // \\} - // , ""); - //} + case.addCompareOutput( + \\fn assert(ok: bool) void { + \\ if (!ok) unreachable; + \\} + \\ + \\fn foo(ok: bool) i32 { + \\ const val: i32 = blk: { + \\ var x: i32 = 1; + \\ if (!ok) break :blk x + 9; + \\ break :blk x + 19; + \\ }; + \\ return val + 10; + \\} + \\ + \\export fn main() c_int { + \\ assert(foo(false) == 20); + \\ assert(foo(true) == 30); + \\ return 0; + \\} + , ""); + } - //{ - // var case = ctx.exeUsingLlvmBackend("nested blocks", linux_x64); + { + var case = ctx.exeUsingLlvmBackend("nested blocks", linux_x64); - // case.addCompareOutput( - // \\fn assert(ok: bool) void { - // \\ if (!ok) unreachable; - // \\} - // \\ - // \\fn foo(ok: bool) i32 { - // \\ var val: i32 = blk: { - // \\ const val2: i32 = another: { - // \\ if (!ok) break :blk 10; - // \\ break :another 10; - // \\ }; - // \\ break :blk val2 + 10; - // \\ }; - // \\ return val; - // \\} - // \\ - // \\export fn main() c_int { - // \\ assert(foo(false) == 10); - // \\ assert(foo(true) == 20); - // \\ return 0; - // \\} - // , ""); - //} + case.addCompareOutput( + \\fn assert(ok: bool) void { + \\ if (!ok) unreachable; + \\} + \\ + \\fn foo(ok: bool) i32 { + \\ var val: i32 = blk: { + \\ const val2: i32 = another: { + \\ if (!ok) break :blk 10; + \\ break :another 10; + \\ }; + \\ break :blk val2 + 10; + \\ }; + \\ return val; + \\} + \\ + \\export fn main() c_int { + \\ assert(foo(false) == 10); + \\ assert(foo(true) == 20); + \\ return 0; + \\} + , ""); + } { var case = ctx.exeUsingLlvmBackend("while loops", linux_x64); |
