← All repos

ppx_expect

Cram like framework for OCaml

Browse cluster: OCaml incremental computation and PPX tooling
180commits
13contributors
8languages

Tech stack & purpose

Ppx_expect is a testing framework for OCaml that works similarly to Cram, built on top of the inline test framework. It provides a `let%expect_test` construct that allows developers to write tests containing output-generating code interleaved with `[%expect]` blocks that specify expected output. The framework automatically captures program output, compares it against expectations, and generates ".corrected" files with diffs when tests fail, making it easy to update tests with actual output. The project is written in OCaml and is maintained by Jane Street, as evidenced by references to Jane Street's inline test framework and related helper libraries. Ppx_expect handles sophisticated test scenarios including exception handling, unreachable code paths, multiple test executions with different outputs, and formatting-aware output matching that normalizes whitespace while preserving relative indentation and structure.

Community & reference links

Languages

OCaml
93.9%
C
3.4%
WebAssembly
0.9%
Raku
0.8%
JavaScript
0.7%
Shell
0.2%
Makefile
0.1%
Dune
0.0%

Contributors