package craml

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Library to handle cram tests format.

type output = [
  1. | `Output of string
  2. | `Ellipsis
]

The type for output lines.

type line = [
  1. | output
  2. | `Command of string list
  3. | `Comment of string
  4. | `Part of string
  5. | `Non_det of [ `Output | `Command ]
  6. | `Exit of int
]

The type for all lines.

val pp_command : string list Fmt.t

pp_command display a multi-line command.

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 = {
  1. part : string option;
  2. non_deterministic : [ `Command | `Output | `False ];
  3. command : string list;
  4. output : output list;
  5. lines : line list;
  6. exit_code : int;
}

The type for tests.

type item =
  1. | Test of test
  2. | Line of line

The type for test items

type t = item list

The type for cram files.

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 part : string -> t -> t option

part i t is the i-th part in t.

val pp_exit_code : int Fmt.t

Display exit code.

val equal_output : output list -> output list -> bool

equal x y compares x and y; Ellipsis are used as wildcards for zero, one or multiple matching lines.

val to_html : t -> string
OCaml

Innovation. Community. Security.