Issue #926: nikaia test: a test program of several files (tests/NAME/ with its own src/)

Open and answer this issue on GitHub.

ready · opened 2026-10-28 · updated 2026-10-28 · 0 comments

Finding. nikaia test takes a test program from exactly one file, tests/NAME.nika (ADR-269 D22, project_tests.nika: run_program_test copies it to src/main.nika of a sandbox package). A defect that needs two files of one package cannot be written as a Nikaia test.

The case that met it: a struct of views declared in one file, a method in another that pushes a view into a field of it. The keep pass (contracts::keep::infer, buffer_plans) computed each unit’s plans against that unit’s own declarations, so the method’s contract had no keep, and the emitted body asked for __keep, which was not there (Cannot find value '__keep' in this scope). It is fixed with the package-wide keep::beside(units). Its probe has two files, main.nika and tree.nika, so it is not in tests/compiler/tests/.

To build

  1. project_tests.nika: a directory tests/NAME/ that holds .nika files is a test program of several files. They are copied as the sandbox package’s src/, and main.nika among them is the entry. NAME.stdout and NAME.stderr sit beside it as for a single file.
  2. Spec text in Part III next to D22, and an ADR line if needed.
  3. Add the cross-file keep case above as the first such test.

Back to Open Issues