js: coroutine JS step — pre-load spec/coroutines.sx in run_tests.js
All CEK primitives (cek-step-loop/cek-resume/make-cek-state/cek-suspended?/ cek-io-request/cek-terminal?/cek-value) were already registered in sx-browser.js. Root cause of test failure: (import (sx coroutines)) creates an io-suspended state when the library isn't pre-loaded; overridden cekRun throws on suspension. Fix: pre-load spec/signals.sx + spec/coroutines.sx before test files run. 17/17 coroutine tests pass in JS. 1965/2500 total (+25 vs 1940 baseline), zero new failures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -343,6 +343,20 @@ if (fs.existsSync(swapPath)) {
|
||||
}
|
||||
}
|
||||
|
||||
// Load spec library files (define-library modules imported by tests)
|
||||
for (const libFile of ["signals.sx", "coroutines.sx"]) {
|
||||
const libPath = path.join(projectDir, "spec", libFile);
|
||||
if (fs.existsSync(libPath)) {
|
||||
const libSrc = fs.readFileSync(libPath, "utf8");
|
||||
const libExprs = Sx.parse(libSrc);
|
||||
for (const expr of libExprs) {
|
||||
try { Sx.eval(expr, env); } catch (e) {
|
||||
console.error(`Error loading spec/${libFile}: ${e.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load tw system (needed by spec/tests/test-tw.sx)
|
||||
const twDir = path.join(projectDir, "shared", "sx", "templates");
|
||||
for (const twFile of ["tw-type.sx", "tw-layout.sx", "tw.sx"]) {
|
||||
|
||||
Reference in New Issue
Block a user