Legend:
Library
Module
Module type
Parameter
Class
Class type
Command-line interface.
When this module is loaded, it parses command line options unconditionally as a side-effect, using the Clap library.
In general, you probably don't need to use this module to define tests. See "Defining Custom Arguments".
Defining Custom Arguments
Tezt uses the Clap library to define its command-line arguments. Clap.close, which signals the end of command-line argument definitions, is called by Test.run.
This means that you can define your own arguments with Clap before calling Test.run. In general, you should avoid using their values before Clap.close, so you should only use them inside tests (i.e. from functions given to Test.register). There are exceptions to this rule (see the README of Clap).
You should avoid defining unnamed arguments (i.e. arguments that are not prefixed by a dash), because those are already used by Tezt for tags.
Command-line arguments that control the set of tests to run.
Defining Custom Arguments (Deprecated Method)
The functions below are deprecated. Instead, you can define arguments using Clap directly (see "Defining Custom Arguments").
val get : ?default:'a->(string ->'a option)->string ->'a
Get the value for a parameter specified with --test-arg.
Usage: get parse parameter
If --test-arg parameter=value was specified on the command-line, this calls parse on value. If parse returns None, this fails. If parse returns Some x, this returns x.
If no value for parameter was specified on the command-line, this returns default if default was specified. Else, this fails.
It is recommended to make it so that specifying parameters with --test-arg is not mandatory for everyday use. This means it is recommended to always give default values, and that those default values should be suitable for typical test runs. For parameters that can take a small number of values, it is usually better to register multiple tests, one for each possible value, and to use tags to select from the command-line.
raisesFailure
if parse returns None or if parameter was not specified on the command-line using --test-arg and no default value was provided.
val get_opt : (string ->'a option)->string ->'a option
Same as get parse parameter but return None if parameter is absent.
val get_bool : ?default:bool ->string -> bool
Same as get bool_of_string_opt.
val get_bool_opt : string ->bool option
Same as get_opt bool_of_string_opt.
val get_int : ?default:int ->string -> int
Same as get int_of_string_opt.
val get_int_opt : string ->int option
Same as get_opt int_of_string_opt.
val get_float : ?default:float ->string -> float
Same as get float_of_string_opt.
val get_float_opt : string ->float option
Same as get_opt float_of_string_opt.
val get_string : ?default:string ->string -> string