Rules
LinkTest completion and failure reporting
topaz test checks the selected entry before execution. After a successful SELF execution, it writes {entry}: test- followed by a newline to standard output. A reported runtime failure writes its diagnostic and {entry}: test failed to standard error and exits unsuccessfully. A unit with compilation diagnostics does not execute.
Success includes deferred cleanup. Deferred errors and process exit codes follow the test command.
Why
Checking before execution prevents invalid programs from producing effects. Separate success and failure channels let test runners distinguish completion from a failed test.
Source evidence
- test_selected_entry at
151141d7bb44· 125-134 - execute_self_lowered_product at
151141d7bb44· 69-100 - compile_self_lowered_product at
151141d7bb44· 120-135 - gatePreparedCallCapabilities at
151141d7bb44· 1274-1287
Equality assertions
The operands of std. use the ordinary equality domain.
Equal values return () and execution continues. Unequal values raise TPZ4007 with the rendered actual and expected values.
Known noncomparable operands produce TPZ5007 during checking.
Argument evaluation and assertion failure follow Test comparisons.
Why
Using ordinary value equality keeps tests consistent with comparisons in program code. Reporting both operands makes a mismatch inspectable.
Source evidence
- STD_TEST_521 at
151141d7bb44· 438-448 - lispexIntrinsic test operations at
151141d7bb44· 49-57 - builtin_test_assert_eq at
151141d7bb44· 3-34 - gatePreparedCallCapabilities at
151141d7bb44· 1274-1287 - FAULT_ASSERT at
151141d7bb44· 157-168 - topaz.decision.capability-domains.1 at
topaz.decisi - topaz.decision.test-assertions-and-golden.1 at
topaz.decisi
Examples
LinkA successful test reports completion
Linklet value = 1
test-result.tpz: test-ok
Expected result
Expected result
Execution completes. Exit code 0.
test-result.tpz: test-ok
Source evidence
- test_selected_entry at
151141d7bb44· 125-134 - execute_self_lowered_product at
151141d7bb44· 69-100 - compile_self_lowered_product at
151141d7bb44· 120-135 - gatePreparedCallCapabilities at
151141d7bb44· 1274-1287
Equality returns unit and execution continues
Linkimport std.ioimport std.testlet result: () = test.assertEq([1, 2], [1, 2])io.writeLine("{result}")
()
Expected result
Expected result
Execution completes. Exit code 0.
()
Source evidence
- STD_TEST_521 at
151141d7bb44· 438-448 - lispexIntrinsic test operations at
151141d7bb44· 49-57 - builtin_test_assert_eq at
151141d7bb44· 3-34 - gatePreparedCallCapabilities at
151141d7bb44· 1274-1287 - FAULT_ASSERT at
151141d7bb44· 157-168
Reject function equality before execution
Linkimport std.testfunction value(x: int) -> int { x }test.assertEq(value, value)
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5007test-assert-eq-non-comparable attest-input-bad.tpz:3:1
Source evidence
- test_selected_entry at
151141d7bb44· 125-134 - execute_self_lowered_product at
151141d7bb44· 69-100 - compile_self_lowered_product at
151141d7bb44· 120-135 - gatePreparedCallCapabilities at
151141d7bb44· 1274-1287 - STD_TEST_521 at
151141d7bb44· 438-448 - lispexIntrinsic test operations at
151141d7bb44· 49-57 - builtin_test_assert_eq at
151141d7bb44· 3-34 - gatePreparedCallCapabilities at
151141d7bb44· 1274-1287 - FAULT_ASSERT at
151141d7bb44· 157-168
An unequal assertion fails the test
Linkimport std.testtest.assertEq(1, 2)
Expected result
Expected result
The independently intended result is a nonzero exit, TPZ4007, and the test-failed footer. The dedicated installed-CLI product test has not run in this sandbox.
The intended runtime outcome is TPZ4007, an unsuccessful exit, and test- on standard error. A dedicated installed-CLI product test checks these observations for this exact fixture. Its execution awaits the public CLI integration run.
Source evidence
- test_selected_entry at
151141d7bb44· 125-134 - execute_self_lowered_product at
151141d7bb44· 69-100 - compile_self_lowered_product at
151141d7bb44· 120-135 - gatePreparedCallCapabilities at
151141d7bb44· 1274-1287 - STD_TEST_521 at
151141d7bb44· 438-448 - lispexIntrinsic test operations at
151141d7bb44· 49-57 - builtin_test_assert_eq at
151141d7bb44· 3-34 - gatePreparedCallCapabilities at
151141d7bb44· 1274-1287 - FAULT_ASSERT at
151141d7bb44· 157-168