Library to handle cram tests format.
type line
= [
| output |
| `Command of string list |
| `Comment of string |
| `Part of string |
| `Non_det of [ `Output | `Command ] |
| `Exit of int |
]
The type for all lines.
val pp_line : ?hide:bool ‑> line Fmt.t
pp_line
is the pretty-printer for lines. If hide
is true,
commands starting by @@
are not displayed. By default, hide
is
not set (all the lines are printed).
type test
=
{
part : string option; |
non_deterministic : [ `Command | `Output | `False ]; |
command : string list; |
output : output list; |
lines : line list; |
exit_code : int; |
}
The type for tests.
val pp : ?hide:bool ‑> t Fmt.t
val to_string : ?hide:bool ‑> t ‑> string
val parse_file : string ‑> t
val parse_lexbuf : Lexing.lexbuf ‑> t
val run : string ‑> f:(string ‑> t ‑> string) ‑> unit
run n f
runs the expect callback f
over the file named
n
. f
is called with the raw contents of n
and its structured
contents; it returns the new file contents. If the result of f
is
different from the initial contents, then $n.corrected
is created
with the new contents.
val to_html : t ‑> string