also looking at this
test(window): make "every window can be reopened" a property the build checks
#76
4 files
+432
-23
| @@ -706,6 +706,32 @@ pub fn build(b: *std.Build) void { | ||
| 706 | 706 | }), |
| 707 | 707 | }); |
| 708 | 708 | |
| 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 | ||
| 709 | 735 | // The conformance test: what craft declares, against what it dispatches. |
| 710 | 736 | const capability_conformance_tests = b.addTest(.{ |
| 711 | 737 | .root_module = b.createModule(.{ |
| @@ -1077,6 +1103,8 @@ pub fn build(b: *std.Build) void { | ||
| 1077 | 1103 | const run_local_tls_tests = b.addRunArtifact(local_tls_tests); |
| 1078 | 1104 | const run_menu_roles_tests = b.addRunArtifact(menu_roles_tests); |
| 1079 | 1105 | 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); | |
| 1080 | 1108 | const run_external_link_tests = b.addRunArtifact(external_link_tests); |
| 1081 | 1109 | const run_webview_recovery_tests = b.addRunArtifact(webview_recovery_tests); |
| 1082 | 1110 | const run_request_context_tests = b.addRunArtifact(request_context_tests); |
| @@ -1196,6 +1224,8 @@ pub fn build(b: *std.Build) void { | ||
| 1196 | 1224 | test_step.dependOn(&run_local_tls_tests.step); |
| 1197 | 1225 | test_step.dependOn(&run_menu_roles_tests.step); |
| 1198 | 1226 | 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); | |
| 1199 | 1229 | test_step.dependOn(&run_external_link_tests.step); |
| 1200 | 1230 | test_step.dependOn(&run_webview_recovery_tests.step); |
| 1201 | 1231 | test_step.dependOn(&run_request_context_tests.step); |