Test.Diff
Reporting value differences.
In general the generic differs will do but depending on your application domain you may want to customize how differences on value mismatch are reported. For that devise a differ with make
and pass it to assertion functions.
val make : ('a T.t -> fnd:'a -> exp:'a -> unit B0_std.Fmt.t) -> 'a t
make show
reports diff by calling show
. When called fnd
and exp
are expected to be different as per tester equality, no need to retest them.
val pp : ?diff:'a t -> 'a T.t -> fnd:'a -> exp:'a -> unit B0_std.Fmt.t
pp ?diff t ~fnd ~exp
formats with diff
the differences between fnd
and exp
which are expected to be different as per t
's equality. diff
defaults to default
.
val dumb : 'a t
dumb
is a dumb differ, it pretty prints the values according to tester and separates them by a <>
.
val of_cmd : B0_std.Cmd.t -> 'a t
of_cmd cmd
is a differ from command cmd
which must expect to receive exp
and fnd
as text files as the two first positional arguments in that order. The text files have rendering of the values with the test files to which a final newline is appended.
val git : 'a t
git
diffs by pretty printing the value according to the value tester and diffing the results by shelling out to git diff
. For now this is the default differ.
git_diff ~fnd ~exp
provides access to the underlyling primitive used by git
to diff textual content fnd
and exp
. Note that fnd
and exp
are appended a newline before diffing them.
val default : unit -> 'a t
default ()
is the default differ for the test run.