kaycxx-test
C++ unit test framework
Loading...
Searching...
No Matches
Public Member Functions | List of all members
kaycxx::test::hook Class Reference

Registered setup or teardown hook. More...

#include <kaycxx/test/hook.hpp>

Public Member Functions

 hook (std::string_view name, callback body, std::source_location location=std::source_location::current())
 Creates a hook.
 
void run (run_options const &options=run_options())
 Runs the hook and wraps thrown exceptions in a hook error with source location information.
 

Detailed Description

Registered setup or teardown hook.

The hook stores the registration source location so hook failures can be reported at the user code that registered the hook.

Constructor & Destructor Documentation

◆ hook()

kaycxx::test::hook::hook ( std::string_view  name,
callback  body,
std::source_location  location = std::source_location::current() 
)
explicit

Creates a hook.

Parameters
nameHook name used in failure messages.
bodyHook callback to execute.
locationSource location used when the hook throws an exception without its own location.

Member Function Documentation

◆ run()

void kaycxx::test::hook::run ( run_options const &  options = run_options())

Runs the hook and wraps thrown exceptions in a hook error with source location information.

Parameters
optionsTest execution options.

The documentation for this class was generated from the following file: