Skip to content

Commit

Permalink
add changelog, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpolzin committed Jul 14, 2024
1 parent 979e35a commit bb6c5af
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
29 changes: 29 additions & 0 deletions CHANGELOG_NEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,32 @@ This CHANGELOG describes the merged but unreleased changes. Please see [CHANGELO
#### Network

* Add a missing function parameter (the flag) in the C implementation of `idrnet_recv_bytes`


#### Test

* Renamed `Requirement` to `BackendRequirement`. A new interface has been
introduced with the name `Requirement`, so you should proactively adopt the new
`BackendRequirement` name anywhere you've used `Test.Golden.Requirement`
previously to avoid potentially difficult to understand compiler errors.

* Both the `TestPool` type and the `testsInDir` helper have been reworked to
support a more flexible definition of a "requirement." Any `TestPool` or use
of `testsInDir` that does _not_ specify any constraints/requirements need not
change at all. A `TestPool` with existing requirements shouldn't need to
change, either, unless you'd like to use your own `Requirement` type going
forward instead of the default `BackendRequirement`. If you have a
`testsInDir` with requirements, it will need to change to a `testsInDir'`;
note the tick (apostrophe) in the name. In full, make the following change.

testsInDir "testdir" "My Tests" {requirements = [C, Node]

Should be refactored to:

testsInDir' "testdir" "My Tests" [C, Node]

* The new `Requirement` interface in `Test.Golden` can be implemented for any
type you would like to use to specify requirements for a test pool. This makes
it quite easy to write test pools that are skipped based on any number of
things.

14 changes: 13 additions & 1 deletion libs/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ The second argument to `MkTestPool` (empty in the above example) is a list of
constraints that need to be satisfied to be able to run the tests in the given
pool. An empty list means no requirements. If your tests required racket to be
installed, you could for instance specify `[Racket]`.
See the [`Requirement` type](./Test/Golden.idr#L228) for more.
See the [`BackendRequirement` type](./Test/Golden.idr#L343) for more.

You may have requirements for a particular `TestPool` that aren't simply "The
Node Backend can be used." To represent your own requirements, create a type
that implements the `Requirement` interface and use values of that type instead.

The third argument to `MkTestPool` is an optional backend. In the example we
did not specify any but if you want to use the reference counting C backend
Expand Down Expand Up @@ -94,3 +98,11 @@ can choose whether the output produced by a new test run should become the new
You can even skip the step of creating an `expected` file altogether when you
write a new test case and use interactive mode to accept the output of your
test case as the expectation.

### testsInDir

If you'd like to make a `TestPool` that automatically picks up all the tests
from a particular directory, you can use the `testsInDir` helper function from
the `Test.Golden` module. Note that if you'd like to specify requirements for
your `TestPool`, use the `testsInDir'` helper instead.

0 comments on commit bb6c5af

Please sign in to comment.