package tezt

  1. Overview
  2. Docs

Tezt logs.

val quote_shell : string -> string

Quote or escape a string using shell syntax.

val quote_shell_command : string -> string list -> string

Quote or escape a command with arguments using shell syntax.

Colors

module Color : sig ... end

Logging

val log : level:Cli.log_level -> ?color:Color.t -> ?prefix:string -> ('a, unit, string, unit) Stdlib.format4 -> 'a

Log a message if the log level requested on the command-line allows it.

See the documentation of Cli for a description of each log level and when to use them.

In tests, you should mostly use function info.

val debug : ?color:Color.t -> ?prefix:string -> ('a, unit, string, unit) Stdlib.format4 -> 'a

Same as log ~level:Debug.

val info : ?color:Color.t -> ?prefix:string -> ('a, unit, string, unit) Stdlib.format4 -> 'a

Same as log ~level:Info.

val report : ?color:Color.t -> ?prefix:string -> ('a, unit, string, unit) Stdlib.format4 -> 'a

Same as log ~level:Report.

val warn : ('a, unit, string, unit) Stdlib.format4 -> 'a

Same as log ~level:Warn ~color:red ~prefix:"warn".

val error : ('a, unit, string, unit) Stdlib.format4 -> 'a

Same as log ~level:Error ~color:red ~prefix:"error".

type test_result =
  1. | Successful
  2. | Failed of string
  3. | Aborted

Whether a test succeeded, failed or was aborted by the user.

Failed comes with the error message, which is a string version of the exception that was raised (usually with Test.fail). This message is unused by the Log module itself.

val test_result : progress_state:Progress.t -> iteration:int -> test_result -> string -> unit

Log the result of a test.

progress_state is the current progress state for this test.

iteration is the index of the iteration count to display in --loop mode.

The string argument is the name of the test.

val command : ?color:Color.t -> ?prefix:string -> string -> string list -> unit

Log a command which will be run.

Log it with level Debug, and print it unconditionally with no timestamp if Cli.options.commands is true.