Tests: align reactive/marshes/reactive-runtime island names with live site

Update test-examples.sx to reference the real path-derived names
(~geography/<domain>/<stem>) instead of short aliases, drop the
alias chains in run_tests.ml, and add marshes/_islands loading so
the migrated one-per-file islands resolve. Fix the try-rerender-page
stub in boot-helpers.sx to accept the 3 args its callers pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 10:48:21 +00:00
parent 0a5066a75c
commit ebcb5348ba
3 changed files with 34 additions and 33 deletions

View File

@@ -2479,17 +2479,20 @@ let run_spec_tests env test_files =
(* Island definitions *)
load_module "index.sx" sx_islands_dir;
load_module "demo.sx" sx_islands_dir;
load_module "marshes.sx" sx_islands_dir;
load_module "cek.sx" sx_geo_dir;
(* Load one-per-file islands from _islands/ directories.
The inject_path_name derives ~geography/cek/demo-counter from the file path. *)
Using sx_sx_dir as base matches the live server's naming:
sx/sx/geography/<domain>/_islands/<stem>.sx -> ~geography/<domain>/<stem>. *)
load_dir_recursive (Filename.concat sx_geo_dir "cek/_islands") sx_sx_dir;
let sx_reactive_dir = Filename.concat sx_geo_dir "reactive" in
if Sys.file_exists (Filename.concat sx_reactive_dir "_islands") then
load_dir_recursive (Filename.concat sx_reactive_dir "_islands") sx_sx_dir;
let sx_reactive_runtime_dir = Filename.concat sx_geo_dir "reactive-runtime" in
if Sys.file_exists (Filename.concat sx_reactive_runtime_dir "_islands") then
load_dir_recursive (Filename.concat sx_reactive_runtime_dir "_islands") sx_geo_dir;
load_dir_recursive (Filename.concat sx_reactive_runtime_dir "_islands") sx_sx_dir;
let sx_marshes_dir = Filename.concat sx_geo_dir "marshes" in
if Sys.file_exists (Filename.concat sx_marshes_dir "_islands") then
load_dir_recursive (Filename.concat sx_marshes_dir "_islands") sx_sx_dir;
load_module "reactive-runtime.sx" sx_sx_dir;
(* Create short-name aliases for reactive-islands tests *)
@@ -2497,17 +2500,7 @@ let run_spec_tests env test_files =
try let v = Sx_types.env_get env full in
ignore (Sx_types.env_bind env short v)
with _ -> () in
alias "~reactive-islands/counter" "~reactive-islands/index/demo-counter";
alias "~reactive-islands/temperature" "~reactive-islands/index/demo-temperature";
alias "~reactive-islands/stopwatch" "~reactive-islands/index/demo-stopwatch";
alias "~reactive-islands/reactive-list" "~reactive-islands/index/demo-reactive-list";
alias "~reactive-islands/input-binding" "~reactive-islands/index/demo-input-binding";
alias "~reactive-islands/error-boundary" "~reactive-islands/index/demo-error-boundary";
alias "~reactive-islands/dynamic-class" "~reactive-islands/index/demo-dynamic-class";
alias "~reactive-islands/store-writer" "~reactive-islands/index/demo-store-writer";
alias "~reactive-islands/store-reader" "~reactive-islands/index/demo-store-reader";
alias "~marshes/demo-marsh-product" "~reactive-islands/marshes/demo-marsh-product";
alias "~marshes/demo-marsh-settle" "~reactive-islands/marshes/demo-marsh-settle";
let _ = alias in
(* Determine test files — scan spec/tests/, lib/tests/, web/tests/ *)
let lib_tests_dir = Filename.concat project_dir "lib/tests" in

View File

@@ -806,7 +806,7 @@
(define
try-async-eval-content
(fn (content-src env callback) (try-eval-content content-src env)))
(define try-rerender-page (fn () nil))
(define try-rerender-page (fn (page-name params result) nil))
(define execute-action (fn () nil))
(define bind-preload (fn () nil))
(define persist-offline-data (fn () nil))

View File

@@ -313,55 +313,63 @@
(defsuite
"reactive:islands"
(deftest "counter" (assert-true (island? ~reactive-islands/counter)))
(deftest
"counter"
(assert-true (island? ~geography/reactive/demo-counter)))
(deftest
"temperature"
(assert-true (island? ~reactive-islands/temperature)))
(deftest "stopwatch" (assert-true (island? ~reactive-islands/stopwatch)))
(assert-true (island? ~geography/reactive/demo-temperature)))
(deftest
"stopwatch"
(assert-true (island? ~geography/reactive/demo-stopwatch)))
(deftest
"reactive-list"
(assert-true (island? ~reactive-islands/reactive-list)))
(assert-true (island? ~geography/reactive/demo-reactive-list)))
(deftest
"input-binding"
(assert-true (island? ~reactive-islands/input-binding)))
(assert-true (island? ~geography/reactive/demo-input-binding)))
(deftest
"error-boundary"
(assert-true (island? ~reactive-islands/error-boundary)))
(assert-true (island? ~geography/reactive/demo-error-boundary)))
(deftest
"dynamic-class"
(assert-true (island? ~reactive-islands/dynamic-class)))
(assert-true (island? ~geography/reactive/demo-dynamic-class)))
(deftest
"store-writer"
(assert-true (island? ~reactive-islands/store-writer)))
(assert-true (island? ~geography/reactive/demo-store-writer)))
(deftest
"store-reader"
(assert-true (island? ~reactive-islands/store-reader))))
(assert-true (island? ~geography/reactive/demo-store-reader))))
(defsuite
"marshes:islands"
(deftest
"demo-marsh-product"
(assert-true (island? ~marshes/demo-marsh-product)))
(assert-true (island? ~geography/marshes/demo-marsh-product)))
(deftest
"demo-marsh-settle"
(assert-true (island? ~marshes/demo-marsh-settle))))
(assert-true (island? ~geography/marshes/demo-marsh-settle))))
(defsuite
"reactive-runtime:islands"
(deftest "demo-ref" (assert-true (island? ~reactive-runtime/demo-ref)))
(deftest
"demo-ref"
(assert-true (island? ~geography/reactive-runtime/demo-ref)))
(deftest
"demo-foreign"
(assert-true (island? ~reactive-runtime/demo-foreign)))
(assert-true (island? ~geography/reactive-runtime/demo-foreign)))
(deftest
"demo-machine"
(assert-true (island? ~reactive-runtime/demo-machine)))
(assert-true (island? ~geography/reactive-runtime/demo-machine)))
(deftest
"demo-commands"
(assert-true (island? ~reactive-runtime/demo-commands)))
(deftest "demo-loop" (assert-true (island? ~reactive-runtime/demo-loop)))
(assert-true (island? ~geography/reactive-runtime/demo-commands)))
(deftest
"demo-loop"
(assert-true (island? ~geography/reactive-runtime/demo-loop)))
(deftest
"demo-keyed-lists"
(assert-true (island? ~reactive-runtime/demo-keyed-lists)))
(assert-true (island? ~geography/reactive-runtime/demo-keyed-lists)))
(deftest
"demo-app-shell"
(assert-true (island? ~reactive-runtime/demo-app-shell))))
(assert-true (island? ~geography/reactive-runtime/demo-app-shell))))