Testing And Diagnostics

Warning

This is the current planned CLEAR stdlib design. Full stdlib implementation and stabilization are not planned until v0.3. Treat these pages as design direction, not as a compatibility promise.

Status: prototype, self-host required.

pkg:testing exists today as a package-resolution smoke test. The real package should support compiler and stdlib oracle testing before broad self-host work depends on it.

Planned Testing API

APIStatusNotes
ASSERTplannedCore assertion.
assertEqual(expected, actual)self-host requiredEquality with useful diffs.
assertClose(expected, actual, tolerance)plannedApproximate float assertions.
expectErrorself-host requiredCompile/runtime error assertions.
Fixturesself-host requiredTest data files and temp dirs.
Golden/oracle helpersself-host requiredCompiler output and transpiler tests.
Test filteringplannedCLI runner support.
Leak/profile hooksplannedRuntime integration.
TEST "translates simple pipeline" ->
    clear = rubyToClear("list.map { |x| x + 1 }");
    assertEqual("list |> MAP { (_ + 1) };", clear);
END

Diagnostics

Diagnostics should share formatting, source-span, and diff helpers with tests. Compiler output needs stable ordering and deterministic rendering.

Decisions

Source: docs/stdlib/testing.md