In Rust, the standard test harness will extract snippets from the documentation and run them as tests, e.g. the following documentation will fail the test suite:
/**
* Add two values
*
* ```
* assert_eq!(add(2, 2), 5)
* ```
*/
fn add(x: i32, y: i32) -> i32 {
x + y
}
(with some extensions, this also works for code in .md files)
This is quite convenient to ensure that the documentation is reasonably up-to-date.
Is there any equivalent in the modern OCaml ecosystem?