Tezos_alpha_test_helpers.Scenario_dsltype ('input, 'output) scenarios = | Action : ('input ->
'output Tezos_base.TzPervasives.tzresult Lwt.t) -> ('input, 'output)
scenarios| Empty : ('t, 't) scenarios| Concat : (('a, 'b) scenarios * ('b, 'c) scenarios) -> ('a, 'c) scenarios| Branch : (('a, 'b) scenarios * ('a, 'b) scenarios) -> ('a, 'b) scenarios| Tag : string -> ('t, 't) scenarios| Slow : ('t, 't) scenariosA scenario is a succession of actions. We define a branching path as a way to create multiple tests from the same point. This allows easy compositionality of behaviors with minimal code sharing. The Tag allows to give meaningful identifiers to the branches. It is good practice to tag each case in a branch (it's not necessary, but since test names must be unique, at most one branch can remain unnamed, and even then it can create conflicting names.)
type ('input, 'output) single_scenario = | End_scenario : ('t, 't) single_scenario| Cons : (('input ->
't Tezos_base.TzPervasives.tzresult Lwt.t)
* ('t, 'output) single_scenario) -> ('input, 'output) single_scenarioUnfolded scenario type
val cat_ss :
'a 'b 'c. ('a, 'b) single_scenario ->
('b, 'c) single_scenario ->
('a, 'c) single_scenarioval unfold_scenarios :
'input 'output. ('input, 'output) scenarios ->
(('input, 'output) single_scenario * string list * bool) listval run_scenario :
'input 'output. ('input, 'output) single_scenario ->
'input ->
'output Tezos_base.TzPervasives.tzresult Lwt.ttype test_closure = string * bool * (Tezt_tezos.Protocol.t -> unit Lwt.t)val unfolded_to_test :
((unit, unit) single_scenario * string list * bool) ->
test_closureval register_test : __FILE__:string -> tags:string list -> test_closure -> unitval register_tests :
__FILE__:string ->
tags:string list ->
test_closure list ->
unitUseful aliases and operators
val noop : ('a, 'a) scenariosval no_tag : ('a, 'a) scenariosContinuation connector: execute a then b
Branching connector: creates two tests with different execution paths
Branching combinator: creates a test path for each element in the list.
val end_test : ('a, unit) scenariosEnds the test. Dump the state, returns unit
val tests_of_scenarios :
(string * (unit, 't) scenarios) list ->
test_closure listTransforms scenarios into tests
val exec :
('a -> 'b Tezos_base.TzPervasives.tzresult Lwt.t) ->
('a, 'b) scenariosArbitrary execution
val exec_state :
(('a * 'b) -> ('c, Tezos_base.TzPervasives.tztrace) Stdlib.result Lwt.t) ->
('a * 'b, 'a * 'c) scenariosExecute a function that does not modify the block, only the state
val exec_unit :
('a -> (unit, Tezos_base.TzPervasives.tztrace) Stdlib.result Lwt.t) ->
('a, 'a) scenariosExecute a function that does not modify neither the block nor the state. Usually used for checks/asserts
fold f l folds f over l, fails on empty list
fold_tag f l folds f over l, l has a tag for each of its elements. Fails on empty list.
fold_tag_f f tag l folds f over l, tag returns a tag for each element of l. Fails on empty list.