Failure result passed to reporters when a test case or suite fails.
More...
#include <kaycxx/test/failure.hpp>
|
| | failure (std::string_view description, kaycxx::assert::assertion_error const &error, std::source_location location) |
| | Creates a failure from an assertion error.
|
| |
| | failure (std::string_view description, std::exception const &error, std::source_location location) |
| | Creates a failure from a standard exception and explicit source location.
|
| |
| | failure (std::string_view description, std::source_location location) |
| | Creates a failure for a non-standard unknown exception.
|
| |
| std::string const & | description () const noexcept |
| | Returns the full test or suite description.
|
| |
| std::string const & | error_message () const noexcept |
| | Returns the failure message.
|
| |
| std::source_location const & | location () const noexcept |
| | Returns the source location.
|
| |
| std::optional< std::string > const & | actual () const noexcept |
| | Returns the actual assertion value when available.
|
| |
| std::optional< std::string > const & | expected () const noexcept |
| | Returns the expected assertion value when available.
|
| |
Failure result passed to reporters when a test case or suite fails.
◆ failure() [1/3]
| kaycxx::test::failure::failure |
( |
std::string_view |
description, |
|
|
kaycxx::assert::assertion_error const & |
error, |
|
|
std::source_location |
location |
|
) |
| |
|
explicit |
Creates a failure from an assertion error.
- Parameters
-
| description | Full test or suite description. |
| error | Assertion error thrown by kaycxx::assert. |
| location | Fallback source location to report for the failure when error has no location. |
◆ failure() [2/3]
| kaycxx::test::failure::failure |
( |
std::string_view |
description, |
|
|
std::exception const & |
error, |
|
|
std::source_location |
location |
|
) |
| |
|
explicit |
Creates a failure from a standard exception and explicit source location.
- Parameters
-
| description | Full test or suite description. |
| error | Exception thrown by the test, suite, or hook. |
| location | Source location to report for the failure. |
◆ failure() [3/3]
| kaycxx::test::failure::failure |
( |
std::string_view |
description, |
|
|
std::source_location |
location |
|
) |
| |
|
explicit |
Creates a failure for a non-standard unknown exception.
- Parameters
-
| description | Full test or suite description. |
| location | Source location to report for the failure. |
◆ actual()
| std::optional< std::string > const & kaycxx::test::failure::actual |
( |
| ) |
const |
|
noexcept |
Returns the actual assertion value when available.
- Returns
- The actual value string, or an empty optional when the failure did not come from a value assertion.
◆ description()
| std::string const & kaycxx::test::failure::description |
( |
| ) |
const |
|
noexcept |
Returns the full test or suite description.
- Returns
- The full test or suite description.
◆ error_message()
| std::string const & kaycxx::test::failure::error_message |
( |
| ) |
const |
|
noexcept |
Returns the failure message.
- Returns
- The failure message.
◆ expected()
| std::optional< std::string > const & kaycxx::test::failure::expected |
( |
| ) |
const |
|
noexcept |
Returns the expected assertion value when available.
- Returns
- The expected value string, or an empty optional when the failure did not come from a value assertion.
◆ location()
| std::source_location const & kaycxx::test::failure::location |
( |
| ) |
const |
|
noexcept |
Returns the source location.
- Returns
- The source location.
The documentation for this class was generated from the following file: