Open craigfe opened 4 years ago
I've done some experimenting with this idea in a personal project (here). Not much there yet, but I'll keep adding features and report back.
The biggest win would be to extract parts of ppx_irmin
to a common library that can be shared here, since the implementations of [@@deriving]
and [%check]
outlined above would be almost identical. (At the same time, we could add combinators for variants and records to Alcotest.) This would be the beginning of the great dynamic type consolidation :wink:
@craigfe would you consider that completely dead? because the heavy syntax is still one of the biggest barriers to non-inline testing in OCaml; it'd be great to have a succinct, fluid syntax for Alcotest or OUnit …
I've suggested a design for a succinct test writing syntax that I hope will be less confusing: https://github.com/mirage/alcotest/issues/126#issuecomment-1722621039
A lot of the Alcotest API is quite conducive to code generation. For instance, the structure of a suite could fairly easily be inferred from the structure of modules and functions in the current file:
This allows some flexibility in structuring the tests (they can be split across multiple files / modules), while getting rid of the test registration boilerplate (even after writing a lot of these, I still never remember how to write them properly...). We could support an option for registering tests in top-level structure items (for small test suites), and something like
let%test_lwt
for usingAlcotest_lwt
instead.Other possible candidates for PPX include:
[@@deriving testable]
for generating testable instances for types.[%check: (int * string) list]
for inserting the appropriate testable combinators. This could also insert code locations to make test errors easier to find.