fix the libc compile error tests to only run on linux

master
Andrew Kelley 2019-02-25 21:46:32 -05:00
parent 7571db05de
commit 82fafca375
1 changed files with 22 additions and 19 deletions

View File

@ -1,6 +1,8 @@
const tests = @import("tests.zig");
const builtin = @import("builtin");
pub fn addCases(cases: *tests.CompileErrorContext) void {
if (builtin.os == builtin.Os.linux) {
cases.addTest(
"implicit dependency on libc",
\\extern "c" fn exit(u8) void;
@ -15,12 +17,13 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
"libc headers note",
\\const c = @cImport(@cInclude("stdio.h"));
\\export fn entry() void {
\\ c.printf("hello, world!\n");
\\ _ = c.printf(c"hello, world!\n");
\\}
,
".tmp_source.zig:1:11: error: C import failed",
".tmp_source.zig:1:11: note: libc headers not available; compilation does not link against libc",
);
}
cases.addTest(
"comptime vector overflow shows the index",