Skip to content

Commit

Permalink
stage2: test for comptime error equality
Browse files Browse the repository at this point in the history
  • Loading branch information
g-w1 committed Nov 26, 2020
1 parent 2c3cfdd commit 9651400
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion test/stage2/test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ pub fn addCases(ctx: *TestContext) !void {
\\ : [number] "{rax}" (1),
\\ [arg1] "{rdi}" (1),
\\ [arg2] "{rsi}" (@ptrToInt("Reached\n")),
\\ [arg3] "{rdx}" (21)
\\ [arg3] "{rdx}" (9)
\\ : "rcx", "r11", "memory"
\\ );
\\ return;
Expand Down Expand Up @@ -497,6 +497,42 @@ pub fn addCases(ctx: *TestContext) !void {
"The Types Were Equal\n",
);
}
{
var case = ctx.exe("comptime error equality", linux_x64);
case.addCompareOutput(
\\export fn _start() noreturn {
\\ if (error.V == error.T) {
\\ condPrint();
\\ }
\\
\\ exit();
\\}
\\
\\fn condPrint() void {
\\ asm volatile ("syscall"
\\ :
\\ : [number] "{rax}" (1),
\\ [arg1] "{rdi}" (1),
\\ [arg2] "{rsi}" (@ptrToInt("The errs Were Equal\n")),
\\ [arg3] "{rdx}" (20)
\\ : "rcx", "r11", "memory"
\\ );
\\ return;
\\}
\\
\\fn exit() noreturn {
\\ asm volatile ("syscall"
\\ :
\\ : [number] "{rax}" (231),
\\ [arg1] "{rdi}" (0)
\\ : "rcx", "r11", "memory"
\\ );
\\ unreachable;
\\}
,
"The Types Were Equal\n",
);
}
{
var case = ctx.exe("adding numbers at runtime", linux_x64);
case.addCompareOutput(
Expand Down

0 comments on commit 9651400

Please sign in to comment.