This document defines the expected behavior for stdlib test running follow-up work.
Applies to:
- stdlib test helpers in stdlib/test.tur
- CLI test entry behavior (future tur test command path)
- fixture and output conventions for pass/fail reporting
tests/fixtures/** for test-bearing fixture directories.input.tur.tests/fixtures/errors/** and validated against expected.diag.expected.stdout where provided.deftest registers test definitions in a global registry in declaration order.run-tests! executes registered tests in deterministic order (declaration order).assert expected actual: pass iff values are equal.assert-true x: pass iff x is boolean true.assert-false x: pass iff x is boolean false.assert-nil x: pass iff x is nil.assert-error body: pass iff evaluating body emits an error per test harness policy.:ptr<void>.:ptr<void> is expected is supported.nil where :ptr<void> is expected is supported as a null-callback convention.:ptr<void> is a compile-time arity mismatch.0: all tests pass.1: at least one test fails.2: harness/runtime/configuration error prevented reliable execution.Streaming output:
- . per passing test
- F per failing test
Summary output at end: - total tests - passed - failed - elapsed (optional)
Failure detail block includes: - test name - assertion message / diagnostic snippet - source location if available
expected.timeout)A fixture directory may contain an expected.timeout file whose content is an
integer number of seconds. The test runner kills the compiled binary and marks
the fixture as failed if it runs longer than this timeout. The default when the
file is absent is 10 seconds. Set the value to 0 to disable the timeout
for a fixture.
The runner uses timeout(1) (GNU coreutils), gtimeout (Homebrew coreutils on
macOS), or a perl -e 'alarm N' fallback.
requires.tsan / TUR_TSAN=1)A fixture directory may contain an empty requires.tsan marker file.
TUR_TSAN is not set (default): fixtures with requires.tsan are
skipped (counted as PASS with a (tsan-skipped) detail).TUR_TSAN=1: all fixtures run normally, including those with
requires.tsan. The compiler flags gain -fsanitize=thread -g.Enable TSan for a full test run:
TUR_TSAN=1 make test
# or using the dedicated target:
make test-tsan
The make test-tsan target rebuilds tur itself with -fsanitize=thread and
then sets TUR_TSAN=1 for the test runner.
stdlib/test.tur implementation work.tur test CLI command behavior and fixture validations.