Open Manual

Testing

A Nytrix check is an executable source file that asserts behavior and exits

non-zero on failure.

Tests are ordinary programs. That keeps examples, regressions, and integration

checks close to the language users run outside the test harness.

Minimal check

use std.core
use std.core.iter as it

def xs = [1, 2, 3, 4]
assert_eq(it.filter(xs, fn(v){ (v % 2) == 0 }), [2, 4], "even values")
assert_eq(it.reduce(xs, 0, fn(acc, v){ acc + v }), 10, "sum")

Commands

ny --color=never path/to/check.ny
ny fmt --trim --check path/to/file.ny
ny test --pattern name
ny test --with-stdlib module-or-path

.nshape checks may use flags_matrix when the same source must be compiled

through several native backends. Rows are separated by ; or escaped newlines,

and each row is appended to the normal flags for one focused harness run.

Check classes

ClassScope
ValuePure function, parser, encoder, or transform returns an exact value.
BoundaryFile, process, socket, FFI call, or native handle crosses runtime boundaries.
RegressionA fixed bug has a small reproducer.
IntegrationMultiple modules cooperate.
VisualUI, image, font, renderer, or scene behavior changed.
PerformanceTiming, allocation, throughput, or generated-code behavior changed.

Assertions

use std.core

def condition = true
def actual = [1, 2]
def expected = [1, 2]

assert(condition, "behavior name")
assert_eq(actual, expected, "behavior name")

Assertion messages name behavior, not implementation details. Exact-value

assertions define deterministic behavior. Timing assertions are performance

checks.

IO boundaries

BoundaryDeterministic setup
FilesTemporary path, exact readback, cleanup.
ProcessesBounded command, explicit stdin/stdout, timeout.
SocketsLocal server, readiness check, timeout.
HTTPLocal fixture server or documented local service requirement.
TLSResponse transport/error metadata included in assertion.
TerminalColor disabled unless color is the behavior under test.

Code fences

Every code fence declares what it contains:

FenceRule
nyComplete Nytrix source that must compile as an extracted doc fence.
bashShell command.
jsonManifest or data payload.
textGrammar, output, directory tree, non-source transcript, or contextual source fragment.

Silent success is valid for runnable examples. Assertion failure, panic, nonzero

exit status, or diagnostic output carries the failure signal.

Completion

A change is complete when the focused check passes, relevant formatting/audit

commands pass, and the required build or test target passes.

For compiler, runtime, stdlib, or docs-generator changes, run

./make test --with-stdlib. For documentation-only changes, run ./make docs

and any focused checks for changed examples.