aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2021-01-10 21:10:26 +0100
committerJakub Konka <kubkon@jakubkonka.com>2021-01-13 23:55:56 +0100
commit4ffa8952ccaef106ef4dfcdb4369960816337ba3 (patch)
tree202297748f17748a74a432df4ef8541cdf18a456 /test
parent2ea0901dd639a98f182b71f7da7fde988fdcd91b (diff)
downloadzig-4ffa8952ccaef106ef4dfcdb4369960816337ba3.tar.gz
zig-4ffa8952ccaef106ef4dfcdb4369960816337ba3.zip
macho: add x86_64 tests
Diffstat (limited to 'test')
-rw-r--r--test/stage2/aarch64.zig3
-rw-r--r--test/stage2/test.zig18
2 files changed, 20 insertions, 1 deletions
diff --git a/test/stage2/aarch64.zig b/test/stage2/aarch64.zig
index 1dde30e969..fa3ded5368 100644
--- a/test/stage2/aarch64.zig
+++ b/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);
\\}
,
diff --git a/test/stage2/test.zig b/test/stage2/test.zig
index cd1d6c259d..a6ccade3ea 100644
--- a/test/stage2/test.zig
+++ b/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",
+ );
+ }
}