Update build.zig for unit tests

This commit is contained in:
jaina heartles 2022-11-26 23:11:34 -08:00
parent 5b0505b355
commit de19083cd9

View file

@ -98,16 +98,24 @@ pub fn build(b: *std.build.Builder) !void {
exe.linkLibC();
exe.addSystemIncludePath("/usr/include/");
const unittest_http_cmd = b.step("unit:http", "Run tests for http package");
const unittest_http = b.addTest("src/http/test.zig");
unittest_http_cmd.dependOn(&unittest_http.step);
unittest_http.addPackage(pkgs.util);
//const unittest_util_cmd = b.step("unit:util", "Run tests for util package");
//const unittest_util = b.addTest("src/util/Uuid.zig");
//unittest_util_cmd.dependOn(&unittest_util.step);
//const util_tests = b.addTest("src/util/lib.zig");
const http_tests = b.addTest("src/http/test.zig");
//const sql_tests = b.addTest("src/sql/lib.zig");
http_tests.addPackage(pkgs.util);
//http_tests.addPackage(pkgs.util);
//sql_tests.addPackage(pkgs.util);
const unit_tests = b.step("unit-tests", "Run tests");
//unit_tests.dependOn(&util_tests.step);
unit_tests.dependOn(&http_tests.step);
//unit_tests.dependOn(&sql_tests.step);
//const unit_tests = b.step("unit-tests", "Run tests");
const unittest_all = b.step("unit", "Run unit tests");
unittest_all.dependOn(unittest_http_cmd);
//unittest_all.dependOn(unittest_util_cmd);
const api_integration = b.addTest("./tests/api_integration/lib.zig");
api_integration.addPackage(pkgs.opts);