aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorjoachimschmidt557 <joachim.schmidt557@outlook.com>2021-12-21 23:12:33 +0100
committerjoachimschmidt557 <joachim.schmidt557@outlook.com>2021-12-21 23:13:30 +0100
commitc55f58d8bb38ef356282e43fa010b5e3f8da8a00 (patch)
tree89fbf0136dea7415ed6872f8e37b346b1c1d0490 /test
parentedcebe701339453bf49379d865a8049c5b22a49e (diff)
downloadzig-c55f58d8bb38ef356282e43fa010b5e3f8da8a00.tar.gz
zig-c55f58d8bb38ef356282e43fa010b5e3f8da8a00.zip
stage2 ARM: implement is_err and is_non_err for simple error unions
Diffstat (limited to 'test')
-rw-r--r--test/stage2/arm.zig49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/stage2/arm.zig b/test/stage2/arm.zig
index c8f8d5bfe1..a0b1484b75 100644
--- a/test/stage2/arm.zig
+++ b/test/stage2/arm.zig
@@ -588,4 +588,53 @@ pub fn addCases(ctx: *TestContext) !void {
"",
);
}
+
+ {
+ var case = ctx.exe("errors", linux_arm);
+ case.addCompareOutput(
+ \\pub fn main() void {
+ \\ foo() catch print();
+ \\}
+ \\
+ \\fn foo() anyerror!void {}
+ \\
+ \\fn print() void {
+ \\ asm volatile ("svc #0"
+ \\ :
+ \\ : [number] "{r7}" (4),
+ \\ [arg1] "{r0}" (1),
+ \\ [arg2] "{r1}" (@ptrToInt("Hello, World!\n")),
+ \\ [arg3] "{r2}" ("Hello, World!\n".len),
+ \\ : "memory"
+ \\ );
+ \\ return;
+ \\}
+ ,
+ "",
+ );
+
+ case.addCompareOutput(
+ \\pub fn main() void {
+ \\ foo() catch print();
+ \\}
+ \\
+ \\fn foo() anyerror!void {
+ \\ return error.Test;
+ \\}
+ \\
+ \\fn print() void {
+ \\ asm volatile ("svc #0"
+ \\ :
+ \\ : [number] "{r7}" (4),
+ \\ [arg1] "{r0}" (1),
+ \\ [arg2] "{r1}" (@ptrToInt("Hello, World!\n")),
+ \\ [arg3] "{r2}" ("Hello, World!\n".len),
+ \\ : "memory"
+ \\ );
+ \\ return;
+ \\}
+ ,
+ "Hello, World!\n",
+ );
+ }
}