move test imports to main.zig, remove test_root.zig

Changed files
+10 -8
src
+5 -2
build.zig
··· 46 46 const run_step = b.step("run", "Run the feed server"); 47 47 run_step.dependOn(&run_cmd.step); 48 48 49 - // tests 49 + // tests - use main.zig as root, tests in all imported modules run automatically 50 50 const tests = b.addTest(.{ 51 51 .root_module = b.createModule(.{ 52 - .root_source_file = b.path("src/test_root.zig"), 52 + .root_source_file = b.path("src/main.zig"), 53 53 .target = target, 54 54 .optimize = optimize, 55 55 .imports = &.{ 56 + .{ .name = "websocket", .module = websocket.module("websocket") }, 57 + .{ .name = "zqlite", .module = zqlite.module("zqlite") }, 56 58 .{ .name = "zat", .module = zat.module("zat") }, 57 59 }, 58 60 }), 59 61 }); 62 + tests.linkLibC(); 60 63 61 64 const run_tests = b.addRunArtifact(tests); 62 65 const test_step = b.step("test", "Run unit tests");
+5
src/main.zig
··· 75 75 try posix.setsockopt(fd, posix.SOL.SOCKET, posix.SO.RCVTIMEO, &timeout); 76 76 try posix.setsockopt(fd, posix.SOL.SOCKET, posix.SO.SNDTIMEO, &timeout); 77 77 } 78 + 79 + test { 80 + _ = @import("feed/filter.zig"); 81 + _ = @import("server/stats.zig"); 82 + }
-6
src/test_root.zig
··· 1 - // test root - imports modules to run their tests 2 - 3 - test { 4 - _ = @import("feed/filter.zig"); 5 - _ = @import("server/stats.zig"); 6 - }