diff --git a/bootstrap/Compilation.zig b/bootstrap/Compilation.zig index fb7dd11..50e96b4 100644 --- a/bootstrap/Compilation.zig +++ b/bootstrap/Compilation.zig @@ -3938,7 +3938,7 @@ pub const Builder = struct { } } - if (unit.descriptor.is_test and count.test_declarations > 0) { + if (unit.descriptor.is_test and count.test_declarations > 0 and unit.main_package.? == unit.files.get(builder.current_file).package) { for (test_declarations.items) |test_declaration_node_index| { const test_node = unit.getNode(test_declaration_node_index); assert(test_node.id == .test_declaration); diff --git a/build/test_runner.zig b/build/test_runner.zig index 3bf7720..1cff634 100644 --- a/build/test_runner.zig +++ b/build/test_runner.zig @@ -11,7 +11,6 @@ const TestError = error{ }; fn collectDirectoryDirEntries(allocator: Allocator, path: []const u8) ![]const []const u8{ - std.debug.print("Opening from cwd: {s}\n", .{try std.fs.cwd().realpathAlloc(allocator, ".")}); var dir = try std.fs.cwd().openDir(path, .{ .iterate = true, }); @@ -45,7 +44,7 @@ fn runStandalone(allocator: Allocator, args: struct { var failed_test_count: usize = 0; const total_test_count = test_names.len; - std.debug.print("[{s} START]\n", .{args.group_name}); + std.debug.print("\n[{s} START]\n\n", .{args.group_name}); for (test_names) |test_name| { std.debug.print("{s}... ", .{test_name}); @@ -290,7 +289,6 @@ fn runBuildTests(allocator: Allocator) !void { } pub fn main() !void { - std.debug.print("\n",.{}); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); const allocator = arena.allocator(); try runStandalone(allocator, .{ @@ -301,7 +299,7 @@ pub fn main() !void { try runBuildTests(allocator); try runStandalone(allocator, .{ .directory_path = "test/tests", - .group_name = "TESTS", + .group_name = "TEST EXECUTABLE", .is_test = true, }); } diff --git a/lib/std/std.nat b/lib/std/std.nat index 10b95d3..6dfccbe 100644 --- a/lib/std/std.nat +++ b/lib/std/std.nat @@ -2,6 +2,13 @@ comptime { _ = start; } +test { + _ = build; + _ = builtin; + _ = os; + _ = start; +} + const build = #import("build.nat"); const builtin = #import("builtin.nat"); const os = #import("os.nat");