Changes
8 changed files (+73/-25)
-
-
@@ -27,15 +27,22 @@const exe = addExe(b, .{ .target = target, .optimize = optimize, .legacy = legacy, .legacy = false, .version = version, }); const legacy_exe = addExe(b, .{ .target = target, .optimize = optimize, .legacy = true, .version = "0.91", }); // "zig build run" { const step = b.step("run", "Build and run sunwait"); const run = b.addRunArtifact(exe); const run = b.addRunArtifact(if (legacy) legacy_exe else exe); if (b.args) |args| { run.addArgs(args); }
-
@@ -75,16 +82,16 @@ };// "zig build" { b.installArtifact(exe); b.installArtifact(if (legacy) legacy_exe else exe); if (man_opt) { b.getInstallStep().dependOn(man); } } // "zig build test" { const step = b.step("test", "Run unit tests"); // "zig build unit-test" const unit_tests = unit_tests: { const step = b.step("unit-test", "Run unit tests"); const t = b.addTest(.{ .name = "unit_test",
-
@@ -106,40 +113,62 @@ t.root_module.addCMacro("SUNWAIT_NOMAIN", "");const run = b.addRunArtifact(t); step.dependOn(&run.step); } // "zig build behavior_test" { const step = b.step("behavior_test", "Run behavior matching tests"); break :unit_tests step; }; const legacy_exe = addExe(b, .{ // "zig build behavior-test" const behavior_tests = behavior_tests: { const step = b.step("behavior-test", "Run behavior matching tests"); const t = b.addTest(.{ .name = "behavior_matching_test", .target = target, .optimize = optimize, .version = "0.91", .legacy = true, .root_source_file = b.path("tests/behavior_matching/main.zig"), }); const new_exe = addExe(b, .{ .target = target, .optimize = optimize, .version = version, }); const config = b.addOptions(); config.addOptionPath("legacy_bin", legacy_exe.getEmittedBin()); config.addOptionPath("new_bin", exe.getEmittedBin()); t.root_module.addOptions("config", config); const run = b.addRunArtifact(t); step.dependOn(&run.step); break :behavior_tests step; }; // "zig build e2e-test" const e2e_tests = e2e_tests: { const step = b.step("e2e-test", "Run end-to-end tests"); const t = b.addTest(.{ .name = "behavior_matching_test", .name = "e2e_test", .target = target, .optimize = optimize, .root_source_file = b.path("tests/main.zig"), .root_source_file = b.path("tests/e2e/main.zig"), }); const config = b.addOptions(); config.addOptionPath("legacy_bin", legacy_exe.getEmittedBin()); config.addOptionPath("new_bin", new_exe.getEmittedBin()); config.addOptionPath("bin", exe.getEmittedBin()); t.root_module.addOptions("config", config); const run = b.addRunArtifact(t); step.dependOn(&run.step); break :e2e_tests step; }; // "zig build test" { const step = b.step("test", "Run all tests"); step.dependOn(unit_tests); step.dependOn(behavior_tests); step.dependOn(e2e_tests); } }
-
-
tests/e2e/main.zig (new)
-
@@ -0,0 +1,20 @@// Copyright (C) 2025 Shota FUJI // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. // // SPDX-License-Identifier: GPL-3.0-only comptime { _ = @import("./help.zig"); }
-
-
-
@@ -19,10 +19,10 @@ const std = @import("std");const config = @import("config"); test { test "should print to stdout" { const result = try std.process.Child.run(.{ .allocator = std.testing.allocator, .argv = &.{ config.new_bin, "--help" }, .argv = &.{ config.bin, "--help" }, }); defer std.testing.allocator.free(result.stderr); defer std.testing.allocator.free(result.stdout);
-
-
-
-
@@ -19,6 +19,5 @@ comptime {_ = @import("./report.zig"); _ = @import("./poll.zig"); _ = @import("./list.zig"); _ = @import("./help.zig"); _ = @import("./version.zig"); }
-
-
-
-