aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-25 21:46:32 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-25 21:46:32 -0500
commit82fafca375ebf474e95a7312bb2c96f8df30375e (patch)
treeee7d20d99ba1ad0d398e15ef924491ba7ccf6bc4 /test
parent7571db05de3efcbc70a8404de6f479909b465eaa (diff)
downloadzig-82fafca375ebf474e95a7312bb2c96f8df30375e.tar.gz
zig-82fafca375ebf474e95a7312bb2c96f8df30375e.zip
fix the libc compile error tests to only run on linux
Diffstat (limited to 'test')
-rw-r--r--test/compile_errors.zig41
1 files changed, 22 insertions, 19 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index d11c077164..58a7190c67 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -1,26 +1,29 @@
const tests = @import("tests.zig");
+const builtin = @import("builtin");
pub fn addCases(cases: *tests.CompileErrorContext) void {
- cases.addTest(
- "implicit dependency on libc",
- \\extern "c" fn exit(u8) void;
- \\export fn entry() void {
- \\ exit(0);
- \\}
- ,
- ".tmp_source.zig:3:5: error: dependency on library c must be explicitly specified in the build command",
- );
+ if (builtin.os == builtin.Os.linux) {
+ cases.addTest(
+ "implicit dependency on libc",
+ \\extern "c" fn exit(u8) void;
+ \\export fn entry() void {
+ \\ exit(0);
+ \\}
+ ,
+ ".tmp_source.zig:3:5: error: dependency on library c must be explicitly specified in the build command",
+ );
- cases.addTest(
- "libc headers note",
- \\const c = @cImport(@cInclude("stdio.h"));
- \\export fn entry() void {
- \\ c.printf("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(
+ "libc headers note",
+ \\const c = @cImport(@cInclude("stdio.h"));
+ \\export fn entry() void {
+ \\ _ = 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",