macho: add x86_64 tests

This commit is contained in:
Jakub Konka 2021-01-10 21:10:26 +01:00
parent 2ea0901dd6
commit 4ffa8952cc
2 changed files with 20 additions and 1 deletions

View File

@ -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);
\\}
,

View File

@ -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",
);
}
}