Skip to main content

Testing Rules

Rules that integrate automated testing into the build pipeline.


Rules

RuleDefaultEffect
max_auto_test_duration_ms5000Maximum time in milliseconds for the automatic tests/auto suite

How tests/auto Works

When a project contains a tests/auto/ directory and a compiled morph executable at build/bin/morph, the compiler uses the native test framework as a build gate.

Build Gate Flow

  1. Source files are compiled.
  2. If build/bin/morph exists and tests/auto/ exists:
    • the compiler runs build/bin/morph test tests/auto
    • if tests fail, the build is blocked
    • if tests exceed the configured time limit, the build is blocked
  3. Only after the automatic test suite passes does the build succeed

On Failure

Build blocked: automated tests failed.

On Timeout

Build blocked: automated tests exceeded 5000 ms (actual: 7234 ms).

Project Structure

my_project/
|-- tests/
| |-- auto/ <- auto-run Morph tests live here
| `-- unit/ <- optional manual or non-gated tests
`-- build/
`-- bin/
`-- morph <- test runner executable

Each .mx file in tests/auto/ should follow the same native rule used by the repository behavior suite:

  • one .mx file = one scenario
  • exactly one top-level test {} block per file
  • expectations written in source through Std.Test

Why This Matters

This keeps source verification inside the language itself:

  • builds run Morph-authored tests, not an external sidecar framework
  • failing tests block the build immediately
  • slow auto suites also block the build
  • agents must fix broken source behavior before the change can land

Next Steps