Compare commits

..

No commits in common. "5b2962fdc0214ef41017eea61626029d6d588af0" and "163150690f8d7b94e51a941f43400c602f0aa127" have entirely different histories.

3 changed files with 31 additions and 15 deletions

View file

@ -55,7 +55,15 @@ pub fn build(b: *std.Build) void {
if (b.args) |args| if (b.args) |args|
run_cmd.addArgs(args); run_cmd.addArgs(args);
const main_mod = b.createModule(.{ const mod_tests = b.addTest(.{
.name = "mod_tests",
.root_module = mod,
});
const run_mod_tests = b.addRunArtifact(mod_tests);
const exe_tests = b.addTest(.{
.name = "exe_tests",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"), .root_source_file = b.path("src/main.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
@ -63,24 +71,31 @@ pub fn build(b: *std.Build) void {
.{ .name = "nightwatch", .module = mod }, .{ .name = "nightwatch", .module = mod },
.{ .name = "build_options", .module = options_mod }, .{ .name = "build_options", .module = options_mod },
}, },
}),
}); });
const run_exe_tests = b.addRunArtifact(exe_tests);
const tests = b.addTest(.{ // Integration test suite: exercises the public API by performing real
.name = "tests", // filesystem operations and verifying Handler callbacks via TestHandler.
const integration_tests = b.addTest(.{
.name = "integration_tests",
.root_module = b.createModule(.{ .root_module = b.createModule(.{
.root_source_file = b.path("src/nightwatch_test.zig"), .root_source_file = b.path("src/nightwatch_test.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
.imports = &.{ .imports = &.{
.{ .name = "nightwatch", .module = mod }, .{ .name = "nightwatch", .module = mod },
.{ .name = "main", .module = main_mod },
}, },
}), }),
}); });
const run_tests = b.addRunArtifact(tests); const run_integration_tests = b.addRunArtifact(integration_tests);
const test_step = b.step("test", "Run tests"); const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_tests.step); test_step.dependOn(&run_mod_tests.step);
test_step.dependOn(&run_exe_tests.step);
test_step.dependOn(&run_integration_tests.step);
b.installArtifact(tests); b.installArtifact(mod_tests);
b.installArtifact(exe_tests);
b.installArtifact(integration_tests);
} }

View file

@ -281,3 +281,5 @@ pub fn main() !void {
run_posix(); run_posix();
} }
} }
test "simple test" {}

View file

@ -1,7 +1,6 @@
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin"); const builtin = @import("builtin");
const nw = @import("nightwatch"); const nw = @import("nightwatch");
const main = @import("main");
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// RecordedEvent // RecordedEvent