authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-02-25 21:46:32-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-02-25 21:46:32-05:00
log82fafca375ebf474e95a7312bb2c96f8df30375e
treeee7d20d99ba1ad0d398e15ef924491ba7ccf6bc4
parent7571db05de3efcbc70a8404de6f479909b465eaa

fix the libc compile error tests to only run on linux


1 files changed, 22 insertions(+), 19 deletions(-)

test/compile_errors.zig+22-19
......@@ -1,26 +1,29 @@
11const tests = @import("tests.zig");
2const builtin = @import("builtin");
23
34pub fn addCases(cases: *tests.CompileErrorContext) void {
4 cases.addTest(
5 "implicit dependency on libc",
6 \\extern "c" fn exit(u8) void;
7 \\export fn entry() void {
8 \\ exit(0);
9 \\}
10 ,
11 ".tmp_source.zig:3:5: error: dependency on library c must be explicitly specified in the build command",
12 );
5 if (builtin.os == builtin.Os.linux) {
6 cases.addTest(
7 "implicit dependency on libc",
8 \\extern "c" fn exit(u8) void;
9 \\export fn entry() void {
10 \\ exit(0);
11 \\}
12 ,
13 ".tmp_source.zig:3:5: error: dependency on library c must be explicitly specified in the build command",
14 );
1315
14 cases.addTest(
15 "libc headers note",
16 \\const c = @cImport(@cInclude("stdio.h"));
17 \\export fn entry() void {
18 \\ c.printf("hello, world!\n");
19 \\}
20 ,
21 ".tmp_source.zig:1:11: error: C import failed",
22 ".tmp_source.zig:1:11: note: libc headers not available; compilation does not link against libc",
23 );
16 cases.addTest(
17 "libc headers note",
18 \\const c = @cImport(@cInclude("stdio.h"));
19 \\export fn entry() void {
20 \\ _ = c.printf(c"hello, world!\n");
21 \\}
22 ,
23 ".tmp_source.zig:1:11: error: C import failed",
24 ".tmp_source.zig:1:11: note: libc headers not available; compilation does not link against libc",
25 );
26 }
2427
2528 cases.addTest(
2629 "comptime vector overflow shows the index",