package b0
Install
Dune Dependency
Authors
Maintainers
Sources
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e
doc/b0.kit/B0_expect/index.html
Module B0_expect
B0 expectation tests.
An expectation test runs a program or sequence of programs in a given environment with given inputs and checks designated outputs against expected outcomes.
B0 expectation tests use your VCS to integrate and correct tests.
See the TODO.
The type for expectation test runners. It represents a context to run a set of expctation tests.
module Outcome : sig ... end
Expectation test outcomes.
val make :
?vcs:B00_vcs.t ->
?prefix:B0_std.Fpath.t ->
B0_cmdlet.Env.t ->
base:B0_std.Fpath.t ->
(t, string) result
make env ~base
is an expectation test runner in environment env
.
vcs
is the VCS to use by default looked up withB00_vcs.t
inB0_cmdlet.Env.scope_dir
prefix
prefix
is a prefix relative to which relative paths are interpreted and absolute path suffixes highlighed defaults (maybe relativiized in the future) toB0_cmdlet.Env.scope_dir
.base
is a base directory in which the expectations are located relative toprefix
.
Note. It's important to have a well defined base
in which expectations are VCS controlled so so that users can get easily get summaries and diffs via their VCS without the noise of surrounding changes.
val prefix : t -> B0_std.Fpath.t
prefix exp
is the prefix of exp
. See make
.
val base : t -> B0_std.Fpath.t
base exp
is the absolute base path of exp
. See make
.
val base_files : t -> recurse:bool -> (B0_std.Fpath.t list, string) result
base_files exp ~recurse
are the files in base exp
and sub directories if recurse
is true
.
val dur : t -> B0_std.Mtime.span
dur exp
is the monotonic duration since make
.
Primitives
val file_outcome : t -> B0_std.Fpath.t -> (Outcome.t, string) result
file_outcome exp f
is the expectation test outcome for file f
in exp
.
Showing results
val log_outcome : t -> B0_std.Fpath.t -> Outcome.t -> unit
log_outcome f o
logs the outcome o
of file f
. At some point we likely want to add f
to o
. This should be done as soon as possible.
val log_results : t -> Outcome.t list -> B0_std.Os.Exit.t
log_results t os
logs the result os
. dir
is the path used to print VCS command for the summary or diff.
Derived expectations
Note these do log outcomes.
val stdout :
t ->
?env:B0_std.Os.Env.assignments ->
?cwd:B0_std.Fpath.t ->
stdout:B0_std.Fpath.t ->
B0_std.Cmd.t ->
(Outcome.t, string) result