A test is a function carrying Test that returns a prelude.Result. Nothing else is required: there is no registry and no base type, so the runner reaches for reflect and finds tests by reading a module rather than by being told about them.
The other attributes adjust what happens to one. Skip keeps it out of the run, Todo marks it as expected to be unfinished, Only narrows the run to itself, and Comment attaches a note that reporters print.
This module is only the vocabulary. tests.assert writes the assertions, tests.runner finds and runs them, and tests.tap reports what happened.
union TestCaseDetails {
None
TestCaseDetailsSkip
TestCaseDetailsTodo
TestCaseDetailsOnly
}
Each member says how to be read as an Option, the way prelude’s own Result members do: a union’s attributes are not read off a value of one of its members.
Cases
Case
Interpretation
None
The absent value.
TestCaseDetailsSkip
TestCaseDetailsTodo
TestCaseDetailsOnly
TestEvent
`tests/types.zirr:39`
union TestEvent {
Discovered
Skipped
Started
Finished
Completed
}
Cases
Case
Interpretation
Discovered
Skipped
Started
Finished
Completed
Data
Completed
`tests/types.zirr:44`
data Completed {
report: TestReport
}
Fields
Field
Description
report
Discovered
`tests/types.zirr:40`
data Discovered {
cases: [TestCase]
}
Fields
Field
Description
cases
FailureRecord
`tests/types.zirr:54`
data FailureRecord {
test: TestCase
error: Err
}
Fields
Field
Description
test
error
Finished
`tests/types.zirr:43`
data Finished {
test: TestCase
outcome: Result
}
Fields
Field
Description
test
outcome
Skipped
`tests/types.zirr:41`
data Skipped {
test: TestCase
}
Fields
Field
Description
test
Started
`tests/types.zirr:42`
data Started {
test: TestCase
}
Fields
Field
Description
test
TestCase
`tests/types.zirr:11`
data TestCase {
name: String
impl:fn() -> Result
skipped: Bool
comment: String
details: TestCaseDetails
}