Module TAPDocument


module TAPDocument: sig .. end
A simplified AST to represent a TAP document

This module is used to create document trees whose output conforms to the TAP protocol. Not many user-servicable parts in here, so unless you are curious, you are more likely to find what you are looking for in the TestSimple or TestBuilder docs.



type status =
| Ok
| NotOk
All tests have a status, which represents the passing or failing of that particular test.

type directive =
| Todo of string
Tests can have directives associated with them, right now we only support the TODO directive. Support for SKIP may come in future versions.

type diagnostic =
| Diag of string list
Diagnostics are bits of text which can be associated with either a test case itself, or within it's own diagnostic node.

type node =
| TestCaseNode of status * int * string * diagnostic option
| TodoTestCaseNode of status * int * string * directive
* diagnostic option
| DiagnosticNode of diagnostic
| PlanNode of int
These are the possible nodes of the document, they are pretty much self explanitory I think.

type t =
| Document of node list
The document is simply a list of nodes

Utilities



Functions for counting the node types.
val count_test_nodes : node list -> int -> int
val count_tests : t -> int
val count_test_failures : t -> int

Functions for creating standard footers. These are called by init_document
val create_failure_footer : int -> int -> node
val create_count_footer : int -> int -> node

Document initializer


val init_document : t -> t
After constructing a document, you must initialize it to assure that it has all the correct footers.

String converters



These are string conversion functions for each of the types defined in this module.
val string_of_status : status -> string
val string_of_diagnostic : diagnostic -> string
val string_of_directive : directive -> string
val string_of_node : node -> string
val string_of_document : t -> string