Module Spec

Specification test parser and runner

val version : string

The specification version.

type id = int

The type for example identifiers.

type test = {
  1. markdown : string;
  2. html : string;
  3. id : id;
  4. start_line : int;
  5. end_line : int;
  6. section : string;
}

The type for tests.

val pp_test_url : test B0_std.Fmt.t

pp_test_url formats an URL that points to the test.

val parse_tests : B0_std.Fpath.t -> (test list, string) Stdlib.result

parse_tests f parses the specification JSON test file.

val select : test list -> id list -> test list * string

select tests ids selects the tests with given ids (empty is all) and returns a label to print

val test_examples : label:string -> test list -> (test -> unit) -> unit

tests_examples ts f tests all tests with f as in a B0_testing block that reports assertion and failure counts as examples count. label is logged before the tests are performed.

Command line

val file : B0_std.Fpath.t Cmdliner.Term.t

file are options to specify the jsont test file.

val ids : id list Cmdliner.Term.t

ids are positional argument that specify a test file.