ReviewOS

also looking at this

craft-native/craft

test(window): make "every window can be reopened" a property the build checks

#76
Merged glennmichael123 wants to merge feat/window-lifecycle-conformance into main
4 files +432 -23
packages/zig/build.zigmodified+30-0
Changes to packages/zig/build.zig
@@ -706,6 +706,32 @@ pub fn build(b: *std.Build) void {
706706 }),
707707 });
708708
709 // Whether every window craft opens can be reopened. A source conformance
710 // test: constructing a window needs a live NSApplication and a WebContent
711 // process, but the two properties worth defending — every constructor
712 // registers, and nothing infers craft-ness from a window again — are
713 // properties of the source.
714 const window_lifecycle_tests = b.addTest(.{
715 .root_module = b.createModule(.{
716 .root_source_file = b.path("test/window_lifecycle_test.zig"),
717 .target = target,
718 .optimize = optimize,
719 }),
720 });
721 window_lifecycle_tests.root_module.addAnonymousImport("src/macos.zig", .{
722 .root_source_file = b.path("src/macos.zig"),
723 });
724
725 // The window registry itself, free of Objective-C so the whole lifecycle
726 // is provable without AppKit.
727 const window_registry_tests = b.addTest(.{
728 .root_module = b.createModule(.{
729 .root_source_file = b.path("src/window_registry.zig"),
730 .target = target,
731 .optimize = optimize,
732 }),
733 });
734
709735 // The conformance test: what craft declares, against what it dispatches.
710736 const capability_conformance_tests = b.addTest(.{
711737 .root_module = b.createModule(.{
@@ -1077,6 +1103,8 @@ pub fn build(b: *std.Build) void {
10771103 const run_local_tls_tests = b.addRunArtifact(local_tls_tests);
10781104 const run_menu_roles_tests = b.addRunArtifact(menu_roles_tests);
10791105 const run_capabilities_tests = b.addRunArtifact(capabilities_tests);
1106 const run_window_lifecycle_tests = b.addRunArtifact(window_lifecycle_tests);
1107 const run_window_registry_tests = b.addRunArtifact(window_registry_tests);
10801108 const run_external_link_tests = b.addRunArtifact(external_link_tests);
10811109 const run_webview_recovery_tests = b.addRunArtifact(webview_recovery_tests);
10821110 const run_request_context_tests = b.addRunArtifact(request_context_tests);
@@ -1196,6 +1224,8 @@ pub fn build(b: *std.Build) void {
11961224 test_step.dependOn(&run_local_tls_tests.step);
11971225 test_step.dependOn(&run_menu_roles_tests.step);
11981226 test_step.dependOn(&run_capabilities_tests.step);
1227 test_step.dependOn(&run_window_lifecycle_tests.step);
1228 test_step.dependOn(&run_window_registry_tests.step);
11991229 test_step.dependOn(&run_external_link_tests.step);
12001230 test_step.dependOn(&run_webview_recovery_tests.step);
12011231 test_step.dependOn(&run_request_context_tests.step);