aboutsummaryrefslogtreecommitdiff
path: root/test/stage2
diff options
context:
space:
mode:
authorVexu <git@vexu.eu>2020-08-19 14:25:47 +0300
committerAndrew Kelley <andrew@ziglang.org>2020-08-19 16:12:29 -0700
commitab8a9a6605900fc0b064c321504ac4e7dc1ca6f4 (patch)
tree46b5cd9da18d8df31b60756eab2347de1b62896b /test/stage2
parent338a495648f07a2734e012034fd301a0e77f8202 (diff)
downloadzig-ab8a9a6605900fc0b064c321504ac4e7dc1ca6f4.tar.gz
zig-ab8a9a6605900fc0b064c321504ac4e7dc1ca6f4.zip
stage2: fix astgen of decl ref, add test for global consts
Diffstat (limited to 'test/stage2')
-rw-r--r--test/stage2/compare_output.zig31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/stage2/compare_output.zig b/test/stage2/compare_output.zig
index 3513605602..2b8c8e94cc 100644
--- a/test/stage2/compare_output.zig
+++ b/test/stage2/compare_output.zig
@@ -617,6 +617,37 @@ pub fn addCases(ctx: *TestContext) !void {
,
"",
);
+
+ case.addCompareOutput(
+ \\export fn _start() noreturn {
+ \\ add(aa, bb);
+ \\
+ \\ exit();
+ \\}
+ \\
+ \\const aa = 'ぁ';
+ \\const bb = '\x03';
+ \\
+ \\fn add(a: u32, b: u32) void {
+ \\ assert(a + b == 12356);
+ \\}
+ \\
+ \\pub fn assert(ok: bool) void {
+ \\ if (!ok) unreachable; // assertion failure
+ \\}
+ \\
+ \\fn exit() noreturn {
+ \\ asm volatile ("syscall"
+ \\ :
+ \\ : [number] "{rax}" (231),
+ \\ [arg1] "{rdi}" (0)
+ \\ : "rcx", "r11", "memory"
+ \\ );
+ \\ unreachable;
+ \\}
+ ,
+ "",
+ );
}
{