ReviewOS

also looking at this

craft-native/craft

test(bridge): the other direction — what window.craft promises

#141
Merged chris wants to merge test/page-surface-conformance into main
2 files +220 -0
packages/zig/build.zigmodified+25-0
Changes to packages/zig/build.zig
@@ -411,6 +411,28 @@ pub fn build(b: *std.Build) void {
411411 // pointers, so the tests build one out of Zig functions and run anywhere —
412412 // no JVM, no emulator, no NDK. That is the whole reason the layer is shaped
413413 // the way it is.
414 // The page surface, across both bridges. Not folded into the iOS
415 // conformance gate: it embeds three files and is about what `window.craft`
416 // offers rather than about iOS, and the iOS gate is already the largest
417 // test in the tree.
418 const bridge_surface_tests = b.addTest(.{
419 .root_module = b.createModule(.{
420 .root_source_file = b.path("test/bridge_surface_test.zig"),
421 .target = target,
422 .optimize = optimize,
423 }),
424 });
425 bridge_surface_tests.root_module.addAnonymousImport("CraftApp.swift", .{
426 .root_source_file = b.path("../ios/templates/CraftApp.swift"),
427 });
428 bridge_surface_tests.root_module.addAnonymousImport("CraftBridge.kt", .{
429 .root_source_file = b.path("../android/templates/CraftBridge.kt.template"),
430 });
431 bridge_surface_tests.root_module.addAnonymousImport("craft.d.ts", .{
432 .root_source_file = b.path("../typescript/types/craft.d.ts"),
433 });
434 const run_bridge_surface_tests = b.addRunArtifact(bridge_surface_tests);
435
414436 const jni_tests = b.addTest(.{
415437 .root_module = b.createModule(.{
416438 .root_source_file = b.path("src/jni_runtime.zig"),
@@ -1574,6 +1596,7 @@ pub fn build(b: *std.Build) void {
15741596 }
15751597 test_step.dependOn(&run_ios_conformance_tests.step);
15761598 test_step.dependOn(&run_jni_tests.step);
1599 test_step.dependOn(&run_bridge_surface_tests.step);
15771600 test_step.dependOn(&run_android_bridge_tests.step);
15781601 test_step.dependOn(&run_menubar_tests.step);
15791602 test_step.dependOn(&run_components_tests.step);
@@ -1660,6 +1683,7 @@ pub fn build(b: *std.Build) void {
16601683 test_ios_step.dependOn(&run_ios_module_tests.step);
16611684 }
16621685 test_ios_step.dependOn(&run_ios_conformance_tests.step);
1686 test_ios_step.dependOn(&run_bridge_surface_tests.step);
16631687
16641688 const test_menubar_step = b.step("test:menubar", "Run Menubar tests");
16651689 test_menubar_step.dependOn(&run_menubar_tests.step);
@@ -2300,6 +2324,7 @@ pub fn build(b: *std.Build) void {
23002324 // second one: `jni_runtime.zig` is the only way anything here reaches Java,
23012325 // so a run that skipped it would not be an Android test run.
23022326 test_android_step.dependOn(&run_jni_tests.step);
2327 test_android_step.dependOn(&run_bridge_surface_tests.step);
23032328 test_android_step.dependOn(&run_android_bridge_tests.step);
23042329
23052330 // Add Android tests to the main test step