Skip to content

[tests] lib/test harness (bench/runner/testing) stale and unreferenced #1066

Closed

Description

@eas4ai

Summary

The lib/test/ harness sources (bench.w, runner.w,
testing.w) do not compile at 450733e (same drift family as
#1053/#1055/#1063, distinct files) and have no callers or build
wiring, so the in-repo test-harness API exists only as stale
text.

Evidence (executed)

with-stage1 check: runner.w:12 (-> void: unknown type),
bench.w:31 (&mut T rejected per §15.1), testing.w:141
(old match-subject syntax). Caller search (lib.test /
lib/test over tests/, lib/, src/, tools/, build.w, docs/):
only the three files reference each other (plus unrelated
testpkg scaffolding and completed-design docs).

Notes

Migrate or remove: either bring them to current syntax and wire
one suite onto them (proving the harness works), or delete them
so-owned-by-nobody helpers stop rotting. The committed suites'
local assert copies are unaffected either way.

Activity

  1. ehartford commented on Sep 16, 2026

    @ehartford
    Contributor

    Review: reproduced (one characterization corrected)

    Verdict. Reproduced: the three lib/test/ harness files do not compile, with the exact drift the report cites. But "no callers or build wiring" is not accurate for bench.w: the with bench command synthesizes a program that does use test.bench and calls into it, so bench.w is the bench harness, not dead text — and because it does not compile, the with bench path is broken, which is a bigger deal than stale helpers. runner.w/testing.w do appear unreferenced.

    Tested.

    Source main @ 5809ac1 (2026-09-14); lib/test/*.w unchanged since the reported revision 450733e
    Compiler with v0.15.2.1 built from 5809ac1 (staging worktree)
    Platform macOS Darwin 25.6.0 arm64

    with check, each file (matches the report):

    • lib/test/runner.w:12: error: unknown type 'void' (pub fn begin() -> void).
    • lib/test/bench.w:31: error: '&mut T' is not part of safe With (§15.1) (fn Bench.set_bytes(self: &mut Bench, ...)).
    • lib/test/testing.w:141: error: expected ':' or '{' after match subject (old match env(...) syntax).

    Correction: bench.w is reached by with bench. synthesize_bench_main_source in src/main.w:3341-3346 emits use test.bench into the program it builds for with bench <file> (run_bench_file, :4040-4058), and the LSP offers use test. completion (src/Lsp.w:1156-1157). So test.bench is a real, intended module. In my environment with bench on a bench_-function file failed with import module not found: 'test.bench' (build-generated modules live under out/gen); module resolution would map test.bench to lib/test/bench.w (the lib/<rel> strategy) when run from the repo, but that file then fails to compile on the &mut error. Either way the bench command cannot use the shipped harness.

    Root cause. Syntax rot (-> void, &mut T, old match) plus a harness that is embedded/wired incompletely — lib/test is not in the embedded-stdlib set (build.w embeds only lib/std), yet with bench depends on test.bench. No compiler defect in the drift itself.

    Severity. Low for runner.w/testing.w (unreferenced dead text). Higher for bench.w: it makes with bench non-functional, which the report understates by grouping all three as "dead."

    Related. #1053/#1055/#1063 (same drift family in tests/). No open PR.

    Recommendation — champion for bench.w, owner's call for the other two. Migrate bench.w to current syntax (mut self/owned param instead of &mut, -> Unit), make test.bench resolvable to with bench (embed lib/test or stage it to out/gen as the error message implies), and add a smoke test that with bench runs a trivial bench_ function. For runner.w/testing.w, either migrate and wire one suite onto them to prove they work, or delete them. Acceptance criteria: with bench compiles and runs a bench_noop; with check lib/test/*.w passes for whatever is kept.

    Blockers / not tested. I did not fully trace how test.bench is meant to reach out/gen in a complete build, so whether with bench works in a fully-built tree is uncertain; the three files' compile failures and with bench's dependency on test.bench are the established facts. Linux/Windows not exercised.

  2. ehartford commented on Oct 25, 2026

    @ehartford
    Contributor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced; none of the three harness files compiles.

    $ with check lib/test/runner.w
    error: unknown type 'void'; With uses Unit for no value and c_void for C void pointers
     --> lib/test/runner.w:12:19
    $ with check lib/test/bench.w
    error: `&mut T` is not part of safe With (§3.1); …
     --> lib/test/bench.w:31:26
    $ with check lib/test/testing.w
    error: expected ':' or '{' after match subject
     --> lib/test/testing.w:141:33
    

    post-release: stale internal sources; repair or removal is a cleanup.

  3. added this to the post-v0.16.0 milestone on Oct 28, 2026
  4. ehartford commented on Nov 11, 2026

    @ehartford
    Contributor

    Merged to main ae20d89 (#3251): lib/test is deleted; nothing imported it (law 9). The harness in use is std.testing and with test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions