alcotest
alcotest copied to clipboard
document testable
I found out about adding new testable types from this blogpost; there is nothing in the project docs about it.
Hi @martindemello,
By "the project docs", do you mean the README in this repository? The generated docs at http://mirage.github.io/alcotest/alcotest/Alcotest/ do reference the Alcotest.testable
helper function for building testable values, as well as the implementation of the Alcotest.testable
type (which is concrete, so can be constructed directly).
yeah, i meant the README and the examples. i didn't see the generated docs because they are also not linked to from the README :) but the package was easy enough to get up to speed with once i got the basic idea; i'll try to contribute some more docs once i've used it for a bit.
yeah, i meant the README and the examples. i didn't see the generated docs because they are also not linked to from the README :)
Good point! They are linked from a little docs badge, but it's not very visible – hopefully #320 will improve that.
i'll try to contribute some more docs once i've used it for a bit.
Thanks!
The approach using a first-class module of type TESTABLE
requires a lot of mental gymnastics to simply provide a pair ~~to_string
/of_string
~~ to_string
/equal
. Please include an example in the API docs.
Here's an example for a fictitious module Fizz
providing a to_string
function and an equal
function with the obvious types:
let fizz = Alcotest.testable (Fmt.of_to_string Fizz.to_string) Fizz.equal
...
let test_something () =
Alcotest.check fizz "equal" Fizz.zero (Fizz.of_string "0")