diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-07-13 00:31:55 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-07-13 00:31:55 -0700 |
| commit | c94652a2fd210fe4f007dbdd47c9e55b38e482fb (patch) | |
| tree | 954fccd90a73b8ed6e7c9f7a45a2c978c1a67840 | |
| parent | 08154c0deb653e016d6eb285c85094048eeded89 (diff) | |
| download | zig-c94652a2fd210fe4f007dbdd47c9e55b38e482fb.tar.gz zig-c94652a2fd210fe4f007dbdd47c9e55b38e482fb.zip | |
stage2: add new test case
| -rw-r--r-- | test/stage2/compare_output.zig | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/test/stage2/compare_output.zig b/test/stage2/compare_output.zig index 1f2853707a..27c9f48d72 100644 --- a/test/stage2/compare_output.zig +++ b/test/stage2/compare_output.zig @@ -120,7 +120,7 @@ pub fn addCases(ctx: *TestContext) !void { } { - var case = ctx.exe("adding numbers", linux_x64); + var case = ctx.exe("adding numbers at comptime", linux_x64); case.addCompareOutput( \\export fn _start() noreturn { \\ asm volatile ("syscall" @@ -143,4 +143,31 @@ pub fn addCases(ctx: *TestContext) !void { "Hello, World!\n", ); } + + { + var case = ctx.exe("adding numbers at runtime", linux_x64); + case.addCompareOutput( + \\export fn _start() noreturn { + \\ add(3, 4); + \\ + \\ exit(); + \\} + \\ + \\fn add(a: u32, b: u32) void { + \\ if (a + b != 7) unreachable; + \\} + \\ + \\fn exit() noreturn { + \\ asm volatile ("syscall" + \\ : + \\ : [number] "{rax}" (231), + \\ [arg1] "{rdi}" (0) + \\ : "rcx", "r11", "memory" + \\ ); + \\ unreachable; + \\} + , + "", + ); + } } |
