Next: , Previous: , Up: API  


1.3 (veritas prelude)

1.3.1 Macros

Macro: display-all-results x

Print and log every test outcome inside all-results using reporter client vc.

Iterates over the compilation of all-results. Evaluates types dynamically:

  • suite-result: Displays suite output, followed by inner test results.
  • pre-test-result: Logs the test identity via vc and displays inner assertions.
  • benchmark-result: Dispatches to log-benchmark.

Throws an explicit error if an unrecognized result type is processed.

Macro: evaluate-thunks x

Evaluate a list of thunks sequentially.

Applies each zero-argument procedure in the list thunks one after another in a synchronous manner.

Returns a list containing the evaluation results of each thunk preserving the original order of the input list.

(evaluate-thunks (list (lambda () (+ 1 1)) (lambda () (* 2 3))))
⇒ (2 6)
Macro: evaluate-thunks-concurrently x

Evaluate a list of thunks concurrently using Guile Fibers.

Each zero-argument procedure in the list thunks is spawned inside its own concurrent fiber thread. This macro blocks the execution of the calling fiber until all spawned thunks have reported their results back through a shared channel.

Exceptions raised within individual fibers are caught safely to avoid hanging or silent termination, returning a formatted error string instead.

Note: The output list order corresponds to the exact completion order of the fibers, meaning it is non-deterministic.

(evaluate-thunks-concurrently
 (list (lambda () (sleep 1) 'delayed)
       (lambda () 'instant)))
⇒ (instant delayed)

1.3.2 Procedures

Procedure: capture-result-and-output thunk

Execute thunk, capturing both its return value and standard output.

Dynamically binds the standard output port to a string port while running thunk. Returns a custom result-and-output object record packing the thunk’s evaluation value and any textual stdout written during runtime. Closes the internal string port safely upon completion.

(capture-result-and-output (lambda () (display "In execution...") 100))
⇒ #<result-and-output result: 100 output: "In execution...">
Procedure: collect-assertion-successful xs

Collect and flatten all assertion success statuses found in xs.

Processes the arbitrary test result tree or list structure xs, extracts all underlying assertion outcomes, and returns a flat list containing only booleans indicating success (#t) or failure (#f).

(collect-assertion-successful my-test-suite-record)
⇒ (#t #t #f #t)
Procedure: collect-assertion-successful* xs

Recursive procedure to extract success values from test data xs.

Dispatches dynamically on the type of xs to look for assertion results:

  • If it is an assertion result, extracts its success state boolean.
  • If it is a pre-test or test result, recursively extracts outcomes from internal fields.
  • Nested lists are mapped over recursively.
  • Unspecified values, benchmark results, and explicit #t values return empty lists.

Raises an error if an unknown object structure is encountered.

Procedure: display-assertion-results assertion-results

Display the captured text outputs for a list of assertion-results.

Iterates over assertion-results. For each item, validates that it is an assertion record and dumps its tracked standard output directly to the current output port. Errors during processing are safely intercepted and logged to stdout without crashing the reporter framework.

Procedure: flatten-list xs

Recursively flatten a nested list structure xs.

Traverses the given structure and flattens all nested sub-lists into a continuous, one-dimensional list of elements. If xs is empty, returns an empty list. If it is a non-list atom, returns it wrapped inside a single-element list.

(flatten-list '((1 2) (3 (4 5)) 6))
⇒ (1 2 3 4 5 6)
Procedure: getenv-or var KEY: #:default

Lookup environment variable var, returning default if absent.

Converts the symbol var into a string to query the operating system’s environment. If the variable does not exist, or if an exception occurs during lookup, the specified default keyword value is returned.

(getenv-or 'GUILE_LOAD_PATH #:default "/usr/share/guile")
⇒ "/usr/share/guile"

Next: (veritas reporter), Previous: (veritas model), Up: API