package tezt
Install
Dune Dependency
Authors
Maintainers
Sources
md5=643f48378265ae18b7aab4675a1e836e
sha512=f399d4d8b935fc3dcb4354596c2b7fa26a019f99c83cb4c1d48b0e26c5bc6da13b2cad9792dd50420a88b777d3b8a1d67c7ddd0457322e65d311b859be03879f
doc/tezt.core/Tezt_core/Cli/index.html
Module Tezt_core.Cli
Source
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 cause Tezt to do something else than running tests.
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").
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.
Same as get parse parameter
but return None
if parameter
is absent.
Same as get bool_of_string_opt
.
Same as get_opt bool_of_string_opt
.
Same as get int_of_string_opt
.
Same as get_opt int_of_string_opt
.
Same as get float_of_string_opt
.
Same as get_opt float_of_string_opt
.
Same as get (fun x -> Some x)
.
Same as get_opt (fun x -> Some x)
.