From 7e11ef79d67d000675e90ddf93fdb78d71cc695d Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 27 Apr 2017 16:15:41 -0400 Subject: zig test no longer requires a separate test_runner.o file See #298 --- std/index.zig | 21 +++++++++++++++++++++ std/special/test_runner.zig | 14 ++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) (limited to 'std') diff --git a/std/index.zig b/std/index.zig index 5deb3d37c4..946a08c93e 100644 --- a/std/index.zig +++ b/std/index.zig @@ -16,3 +16,24 @@ pub const os = @import("os/index.zig"); pub const rand = @import("rand.zig"); pub const sort = @import("sort.zig"); pub const target = @import("target.zig"); + +test "std" { + // run tests from these + _ = @import("base64.zig"); + _ = @import("buffer.zig"); + _ = @import("build.zig"); + _ = @import("c/index.zig"); + _ = @import("cstr.zig"); + _ = @import("debug.zig"); + _ = @import("fmt.zig"); + _ = @import("hash_map.zig"); + _ = @import("io.zig"); + _ = @import("list.zig"); + _ = @import("math.zig"); + _ = @import("mem.zig"); + _ = @import("net.zig"); + _ = @import("os/index.zig"); + _ = @import("rand.zig"); + _ = @import("sort.zig"); + _ = @import("target.zig"); +} diff --git a/std/special/test_runner.zig b/std/special/test_runner.zig index bf85ed07e3..cae42fe0a5 100644 --- a/std/special/test_runner.zig +++ b/std/special/test_runner.zig @@ -1,17 +1,11 @@ const io = @import("std").io; - -const TestFn = struct { - name: []u8, - func: extern fn(), -}; - -extern var zig_test_fn_list: []TestFn; +const test_fn_list = @compileVar("zig_test_fn_slice"); pub fn main() -> %void { - for (zig_test_fn_list) |testFn, i| { - %%io.stderr.printf("Test {}/{} {}...", i + 1, zig_test_fn_list.len, testFn.name); + for (test_fn_list) |test_fn, i| { + %%io.stderr.printf("Test {}/{} {}...", i + 1, test_fn_list.len, test_fn.name); - testFn.func(); + test_fn.func(); %%io.stderr.printf("OK\n"); } -- cgit v1.2.3