Add deps and engine test specs, bootstrap engine to Python
New test specs (test-deps.sx: 33 tests, test-engine.sx: 37 tests) covering component dependency analysis and engine pure functions. All 6 spec modules now have formal SX tests: eval (81), parser (39), router (18), render (23), deps (33), engine (37) = 231 total. - Add engine as spec module in bootstrap_py.py (alongside deps) - Add primitive aliases (trim, replace, parse_int, upper) for engine functions - Fix parse-int to match JS parseInt semantics (strip trailing non-digits) - Regenerate sx_ref.py with --spec-modules deps,engine - Update all three test runners (run.js, run.py, sx-test-runner.js) - Add Dependencies and Engine nav items and testing page entries - Wire deps-source/engine-source through testing overview UI Node.js: 231/231 pass. Python: 226/231 (5 pre-existing parser/router gaps). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -159,6 +159,8 @@ var SPECS = {
|
||||
"parser": { file: "test-parser.sx", needs: ["sx-parse"] },
|
||||
"router": { file: "test-router.sx", needs: [] },
|
||||
"render": { file: "test-render.sx", needs: ["render-html"] },
|
||||
"deps": { file: "test-deps.sx", needs: [] },
|
||||
"engine": { file: "test-engine.sx", needs: [] },
|
||||
};
|
||||
|
||||
function evalFile(filename) {
|
||||
@@ -215,9 +217,6 @@ if (args[0] === "--legacy") {
|
||||
|
||||
// Load prerequisite spec modules
|
||||
if (specName === "router") {
|
||||
// Use bootstrapped router functions from sx-browser.js.
|
||||
// The bare evaluator can't run router.sx faithfully because set!
|
||||
// inside lambda closures doesn't propagate (dict copies, not cells).
|
||||
if (Sx.splitPathSegments) {
|
||||
env["split-path-segments"] = Sx.splitPathSegments;
|
||||
env["parse-route-pattern"] = Sx.parseRoutePattern;
|
||||
@@ -230,6 +229,35 @@ if (args[0] === "--legacy") {
|
||||
}
|
||||
}
|
||||
|
||||
if (specName === "deps") {
|
||||
if (Sx.scanRefs) {
|
||||
env["scan-refs"] = Sx.scanRefs;
|
||||
env["scan-components-from-source"] = Sx.scanComponentsFromSource;
|
||||
env["transitive-deps"] = Sx.transitiveDeps;
|
||||
env["compute-all-deps"] = Sx.computeAllDeps;
|
||||
env["components-needed"] = Sx.componentsNeeded;
|
||||
env["page-component-bundle"] = Sx.pageComponentBundle;
|
||||
env["page-css-classes"] = Sx.pageCssClasses;
|
||||
env["scan-io-refs"] = Sx.scanIoRefs;
|
||||
env["transitive-io-refs"] = Sx.transitiveIoRefs;
|
||||
env["compute-all-io-refs"] = Sx.computeAllIoRefs;
|
||||
env["component-pure?"] = Sx.componentPure_p;
|
||||
env["test-env"] = function() { return env; };
|
||||
}
|
||||
}
|
||||
|
||||
if (specName === "engine") {
|
||||
if (Sx.parseTime) {
|
||||
env["parse-time"] = Sx.parseTime;
|
||||
env["parse-trigger-spec"] = Sx.parseTriggerSpec;
|
||||
env["default-trigger"] = Sx.defaultTrigger;
|
||||
env["parse-swap-spec"] = Sx.parseSwapSpec;
|
||||
env["parse-retry-spec"] = Sx.parseRetrySpec;
|
||||
env["next-retry-ms"] = function(cur, cap) { return Math.min(cur * 2, cap); };
|
||||
env["filter-params"] = Sx.filterParams;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("# --- " + specName + " ---");
|
||||
evalFile(spec.file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user