package mdx

  1. Overview
  2. Docs

Cram tests

type t = {
  1. command : string list;
  2. output : Output.t list;
  3. exit_code : int;
type cram_tests = {
  1. start_pad : int;
  2. hpad : int;
  3. tests : t list;
  4. end_pad : string option;

The type for cram tests.


val exit_code : t -> int

exit_code t is t's exit code.

val use_heredoc : t -> bool

use_heredoc t is true iff t uses the heredoc '<<' syntax.

val command_line : t -> string

command_line t is t's command line. It either adds '\' at the end of each line of t's command or do nothing is t uses the heredoc syntax.


val of_lines : string list -> cram_tests

of_lines l parses the commands l.


val pp : ?pad:int -> t Fmt.t

pp is the pretty-printer for cram tests. pad is the size of the optional whitespace left padding (by default it is 0).

val pp_vertical_pad : int Fmt.t

pp_vertical_pad is the pretty printer for the initial padding on the top of Cram tests

val dump : t Fmt.t

dump it the printer for dumping cram tests. Useful for debugging.

val dump_cram_tests : cram_tests Fmt.t
val pp_command : ?pad:int -> t Fmt.t

pp_command pretty-prints cram commands.

val pp_exit_code : ?pad:int -> int Fmt.t

pp_exit_code pretty-prints exit code.