Issue #1147: Test blocks in tools/*.nika, lowered into the std crate’s tests (moves the compiler’s Rust unit tests into Nikaia)

Open and answer this issue on GitHub.

ready · opened 2026-11-01 · updated 2026-11-01 · 0 comments

Gap

About 900 lines of the compiler’s Rust are #[cfg(test)] unit tests of code that already lives in Nikaia. For example:

CLAUDE.md says an existing Rust test moves to Nikaia. These tests cannot move today:

Decision (supervisor, by the language principles)

This is an obvious extension: tests sit beside the code they test, in the language the code is written in. A test block in a tools file is the same form a package already has.

To build

  1. lower-std takes test blocks in a tools file and writes them into #[cfg(test)] mod tests of its lowered .rs.
    • A test block’s assert lowers as it does in a function.
    • Probe: one test block in threads.nika asserting crossing of i64 is May.
    • If the lowering needs new Rust, the builder stops with Result: blocked, per CLAUDE.md.
  2. Move contracts/send.rs’s tests (197-652) into test blocks in threads.nika / check_send.nika.
  3. Move contracts/ty.rs’s tests into ty.nika.
  4. Move manifest.rs’s tests (272-512) into manifest.nika. Tests that go through toml (codegen_for, items_of) become tests/compiler programs, or stay where they are with a note in the report.

Part of #125.

Back to Open Issues