diff --git a/sx/sxc/pages/docs.sx b/sx/sxc/pages/docs.sx index 0913d38..23416c8 100644 --- a/sx/sxc/pages/docs.sx +++ b/sx/sxc/pages/docs.sx @@ -529,11 +529,11 @@ :data (run-modular-tests "all") :content (~testing-overview-content :server-results server-results - :framework-source (read-spec-file "test-framework.sx") - :eval-source (read-spec-file "test-eval.sx") - :parser-source (read-spec-file "test-parser.sx") - :router-source (read-spec-file "test-router.sx") - :render-source (read-spec-file "test-render.sx"))) + :framework-source framework-source + :eval-source eval-source + :parser-source parser-source + :router-source router-source + :render-source render-source)) (defpage testing-page :path "/testing/" @@ -556,29 +556,29 @@ :spec-name "eval" :spec-title "Evaluator Tests" :spec-desc "81 tests covering the core evaluator and all primitives — literals, arithmetic, comparison, strings, lists, dicts, predicates, special forms, lambdas, higher-order functions, components, macros, threading, and edge cases." - :spec-source (read-spec-file "test-eval.sx") - :framework-source (read-spec-file "test-framework.sx") + :spec-source spec-source + :framework-source framework-source :server-results server-results) "parser" (~testing-spec-content :spec-name "parser" :spec-title "Parser Tests" :spec-desc "39 tests covering tokenization and parsing — integers, floats, strings, escape sequences, booleans, nil, keywords, symbols, lists, dicts, whitespace, comments, quote sugar, serialization, and round-trips." - :spec-source (read-spec-file "test-parser.sx") - :framework-source (read-spec-file "test-framework.sx") + :spec-source spec-source + :framework-source framework-source :server-results server-results) "router" (~testing-spec-content :spec-name "router" :spec-title "Router Tests" :spec-desc "18 tests covering client-side route matching — path splitting, pattern parsing, segment matching, parameter extraction, and route table search." - :spec-source (read-spec-file "test-router.sx") - :framework-source (read-spec-file "test-framework.sx") + :spec-source spec-source + :framework-source framework-source :server-results server-results) "render" (~testing-spec-content :spec-name "render" :spec-title "Renderer Tests" :spec-desc "23 tests covering HTML rendering — elements, attributes, void elements, boolean attributes, fragments, escaping, control flow, and component rendering." - :spec-source (read-spec-file "test-render.sx") - :framework-source (read-spec-file "test-framework.sx") + :spec-source spec-source + :framework-source framework-source :server-results server-results) "runners" (~testing-runners-content) :else (~testing-overview-content diff --git a/sx/sxc/pages/helpers.py b/sx/sxc/pages/helpers.py index ddbc3f8..fc264df 100644 --- a/sx/sxc/pages/helpers.py +++ b/sx/sxc/pages/helpers.py @@ -744,7 +744,7 @@ def _run_modular_tests(spec_name: str) -> dict: elapsed = round((time.monotonic() - t0) * 1000) - return { + result = { "server-results": { "passed": passed, "failed": failed, @@ -752,9 +752,23 @@ def _run_modular_tests(spec_name: str) -> dict: "elapsed-ms": elapsed, "output": "\n".join(lines), "spec": spec_name, - } + }, + "framework-source": _read_spec_file("test-framework.sx"), } + # Include spec sources so :content can reference them from data + if spec_name == "all": + result["eval-source"] = _read_spec_file("test-eval.sx") + result["parser-source"] = _read_spec_file("test-parser.sx") + result["router-source"] = _read_spec_file("test-router.sx") + result["render-source"] = _read_spec_file("test-render.sx") + else: + spec = SPECS.get(spec_name) + if spec: + result["spec-source"] = _read_spec_file(spec["file"]) + + return result + def _data_test_data() -> dict: """Return test data for the client-side data rendering test page.