package mdx

  1. Overview
  2. Docs

Cram tests

type t = {
  1. command : string list;
  2. output : Output.t list;
  3. exit_code : int;
  4. vpad : int;
}

The type for cram tests.

Accessors

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.

Parser

val of_lines : syntax:Syntax.t -> loc:Location.t -> string list -> int * t list

of_lines l parses the commands l. It returns the optional whitespace padding.

Pretty-printer

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 dump : t Fmt.t

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

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.

OCaml

Innovation. Community. Security.