|
micro-test-plus 4.1.0
µTest++ Testing Framework
|
Reflection utilities for the µTest++ testing framework. More...
Classes | |
| class | source_location |
| Local implementation of source location information for diagnostics. More... | |
Functions | |
| const char * | short_name (const char *name) noexcept |
| Extract a short type or function name from a fully qualified name. | |
| template<class T> | |
| constexpr auto | type_name (void) -> std::string_view |
| Extract the type name from the __PRETTY_FUNCTION__ macro. | |
The reflection namespace provides facilities for obtaining source location information and type names at compile time, thereby supporting advanced reporting and diagnostics within the µTest++ framework.
It includes a local implementation of source_location for environments lacking C++20 standard support, as well as utilities for extracting concise type names from compiler-specific macros such as __PRETTY_FUNCTION__.
All definitions within this namespace are intended to facilitate advanced reflection and reporting capabilities.
|
noexcept |
| name | The fully qualified name as a C-string. |
This function extracts the short name from a given file path by locating the final folder separator ('/'). If a separator is found, it returns a pointer to the character immediately following it, effectively providing the file or folder name. If no separator is present, the original input string is returned. This utility is useful for reporting concise file or folder names in test output.
Definition at line 74 of file reflection.cpp.
Referenced by micro_os_plus::micro_test_plus::runner::abort(), micro_os_plus::micro_test_plus::reporter_human::output_fail_prefix_(), and micro_os_plus::micro_test_plus::reporter_tap::output_fail_suffix_().
|
nodiscardconstexpr |
This function template parses the compiler-specific __PRETTY_FUNCTION__ macro to extract a concise type name for the template parameter T.
Rather than relying on fixed character offsets (which are fragile across compiler versions and namespace changes), the implementation searches for well-known marker characters in the function signature string:
This approach is resilient to namespace renaming, namespace nesting changes, and compiler format updates.
| T | The type whose name is to be extracted. |
Definition at line 145 of file reflection-inlines.h.
Referenced by micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<().