test framework phase 1: forward decls, void-return fix, suite migration
El SDK CI - dev / build-and-test (pull_request) Failing after 10m4s

Completes the Phase 1 runner and migrates the 11 test files onto it.

- forward-declare the registry accessors in the test preamble; they are
  defined at the end of the unit but the El runner is compiled in between
- eltest.el: explicit trailing return in the void emit_* helpers, which
  otherwise lower to 'return println(...)' and fail to compile
- test files import runtime/eltest.el explicitly, using the language's own
  textual import mechanism rather than compiler-side auto-injection
- DESIGN.md 6.5: gate on allocation COUNT AND BYTES, not count alone

Verified: self-hosting fixpoint byte-identical (gen2 == gen3). 6 of 11
suites run and report per-test timing. The other 5 fail to COMPILE, and
fail identically under the committed compiler -- pre-existing breakage
this framework makes visible for the first time.
This commit is contained in:
Neuron
2026-08-15 21:28:30 -05:00
parent a668062e38
commit 3e7ab07e82
14 changed files with 617 additions and 0 deletions
+23
View File
@@ -2606,6 +2606,17 @@ fn builtin_arity(name: String) -> Int {
// LSP seed primitives
if str_eq(name, "__read_n") { return 1 }
if str_eq(name, "__print_raw") { return 1 }
// Test-registry accessors. These are not runtime builtins they are
// GENERATED into the same translation unit by the --test path below, one
// set per test binary. They are declared here so the El-side runner in
// runtime/eltest.el can call them with a known arity.
if str_eq(name, "__el_reg_count") { return 0 }
if str_eq(name, "__el_reg_name") { return 1 }
if str_eq(name, "__el_reg_invoke") { return 1 }
if str_eq(name, "__el_reg_last_ns") { return 0 }
if str_eq(name, "__el_reg_msg") { return 0 }
if str_eq(name, "__el_reg_asserts") { return 0 }
if str_eq(name, "__el_opt_json") { return 0 }
// String
if str_eq(name, "el_str_concat") { return 2 }
if str_eq(name, "str_eq") { return 2 }
@@ -4138,6 +4149,18 @@ fn codegen_streaming(tokens: [Any], sigs: [Map<String, Any>], source: String) ->
emit_line(" __el_cur_fails++; __el_cur_asserts++;")
emit_line("}")
emit_blank()
// Forward declarations for the registry accessors. The definitions are
// emitted at the END of the unit (they reference the test functions,
// which do not exist yet at this point), but the El-side runner is
// compiled in between and calls them so it needs the prototypes here.
emit_line("el_val_t __el_reg_count(void);")
emit_line("el_val_t __el_reg_name(el_val_t i);")
emit_line("el_val_t __el_reg_invoke(el_val_t i);")
emit_line("el_val_t __el_reg_last_ns(void);")
emit_line("el_val_t __el_reg_msg(void);")
emit_line("el_val_t __el_reg_asserts(void);")
emit_line("el_val_t __el_opt_json(void);")
emit_blank()
}
// Streaming parse-emit loop.