Skip to content

feat: add the Errata test framework - #956

Open
david-christiansen wants to merge 31 commits into
mainfrom
test-framework-1
Open

feat: add the Errata test framework#956
david-christiansen wants to merge 31 commits into
mainfrom
test-framework-1

Conversation

@david-christiansen

Copy link
Copy Markdown
Collaborator

Errata is a test framework, designed to be something we can extract to its own repo after we get some experience with it here (so it can be used e.g. in verso-slides and lean-sqlite).

In Errata, tests are marked by the @[test] attribute. Their docstring and source range are saved for failure reporting. The value of a test can have any type with an IsTest instance. Some machinery in the Lakefile enumerates all tests, providing them to the runner.

Elaboration-time tests can also be implemented using #test_msgs and #test_guard, which are versions of #guard_msgs and #guard that run the compile-time test but save the result as a test case for reporting together with the rest of the tests.

Errata also supports saving JUnit XML, which various GitHub actions can conveniently display for us.

Errata is a test framework, designed to be something we can extract to its own
repo after we get some experience with it here (so it can be used e.g. in
verso-slides and lean-sqlite).

In Errata, tests are marked by the `@[test]` attribute. Their docstring and
source range are saved for failure reporting. The value of a test can have any
type with an `IsTest` instance. Some machinery in the Lakefile enumerates all
tests, providing them to the runner.

Elaboration-time tests can also be implemented using `#test_msgs` and
`#test_guard`, which are versions of `#guard_msgs` and `#guard` that run the
compile-time test but save the result as a test case for reporting together
with the rest of the tests.

Errata also supports saving JUnit XML, which various GitHub actions can
conveniently display for us.
Migrate command-line parsing to Cli and improve verbosity settings RE success/failure
The update path replaces the recorded tree wholesale, so a path that
changed shape between file and directory no longer makes the update run
throw an IO error.
Dangling bytes at the end of a failing test no longer replace the
message with one about byte encodings.
Text writes go through the same pending-byte pathway as raw writes, so
a print no longer overtakes an earlier raw write that is waiting for
the rest of its code point.
assertTrue now takes an optional detail like the other assertions, so
predicate checks can attach the value that failed them. assertThrowsIO
expects an action to throw an IO.Error, with a predicate picking the
subset of acceptable errors.
This allows warnings such as "unused parameter" to fail in CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant