package testo-diff
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=0998766656d9a756f87c2f6c78b803d3a6e7c1230167c039f288226428cc3137
sha512=bc59a43617d005bc338950b13a2aadb2865bc92ec0d1494e2219d8446e9203916c0c88878dc918ef3b8d2923b874c24bd68cf3a14a8307a0714d6114549f36ef
Description
This is a pure-OCaml implementation for computing line-by-line diffs. The current implementation uses an algorithm similar to gestalt pattern matching ported to OCaml by Gabriel Jaldon from Paul Butler's Python implementation. See https://github.com/paulgb/simplediff
Published: 12 Sep 2025
README
Testo 
Documentation
Features
Testo is a test framework for OCaml that takes inspiration from its predecessor Alcotest and from pytest. Features include:
- support for explicit XFAIL tests i.e. tests that are expected to fail, indicating that they should be fixed eventually;
- support for test snapshots i.e. persistent storage of captured stdout or stderr;
- reviewing and approving tests without re-running them;
- nested test suites;
- various ways to select tests;
- parallel execution (using multiprocessing);
- supports OCaml >= 4.08.
Like with Alcotest, a test executable is generated from a list of tests written in OCaml. The function to interpret the command line and run things is Testo.interpret_argv
. The core subcommands supported by a test executable are:
run
: run testsstatus
: check the status of the tests without re-running themapprove
: approve test output and make it the new reference
A test is fundamentally a name and test function of type unit -> unit
. A test is considered successful if the test function returns normally and is considered failed if it raises an exception. A test is created with Testo.create
which takes a variety of options in addition to the name and the test function.
Testo doesn't provide a library for writing assertions. Using the Alcotest module for this is recommended. For example, checking that some test result res
equals an expected value of 42
is written as:
Alcotest.(check int) "equal" 42 res;
This raises an exception that is turned into a nice error message.
Dependencies (3)
- ppx_deriving
-
ocaml
>= "4.08.0"
-
dune
>= "3.7"
Dev Dependencies (1)
-
odoc
with-doc
Used by (1)
-
testo-util
>= "0.2.0"
Conflicts
None