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