Commit 4ffa8952cc

Jakub Konka <kubkon@jakubkonka.com>
2021-01-10 21:10:26
macho: add x86_64 tests
1 parent 2ea0901
Changed files (2)
test/stage2/aarch64.zig
@@ -209,7 +209,8 @@ pub fn addCases(ctx: *TestContext) !void {
             \\extern "c" fn exit(usize) noreturn;
             \\
             \\export fn _start() noreturn {
-            \\    write(1, @ptrToInt("Hello, World!\n"), 14);
+            \\    write(1, @ptrToInt("Hello,"), 6);
+            \\    write(1, @ptrToInt(" World!\n,"), 8);
             \\    exit(0);
             \\}
         ,
test/stage2/test.zig
@@ -1495,4 +1495,22 @@ pub fn addCases(ctx: *TestContext) !void {
             \\}
         , &[_][]const u8{":8:10: error: evaluation exceeded 1000 backwards branches"});
     }
+
+    {
+        var case = ctx.exe("hello world linked to libc", macosx_x64);
+
+        // TODO rewrite this test once we handle more int conversions and return args.
+        case.addCompareOutput(
+            \\extern "c" fn write(usize, usize, usize) void;
+            \\extern "c" fn exit(usize) noreturn;
+            \\
+            \\export fn _start() noreturn {
+            \\    write(1, @ptrToInt("Hello,"), 6);
+            \\    write(1, @ptrToInt(" World!\n,"), 8);
+            \\    exit(0);
+            \\}
+        ,
+            "Hello, World!\n",
+        );
+    }
 }