reporter-tap.cpp File
C++ source file with implementations for the µTest++ TAP test reporter member functions. More...
Included Headers
Namespaces Index
| namespace | micro_os_plus |
|
The primary namespace for the µOS++ framework. More... | |
| namespace | micro_test_plus |
|
Primary namespace for the µTest++ testing framework. More... | |
| namespace | detail |
|
Internal implementation details for the µTest++ framework. More... | |
| namespace | anonymous{reporter-tap.cpp} |
|
Local helpers of the TAP reporter. More... | |
Classes Index
| class | tap_name |
|
A name prepared for a single TAP line, without a copy when it needs no change. More... | |
Functions Index
| std::string | tap_text (std::string_view text, bool escape) |
|
Prepares a text for a single TAP line. More... | |
| std::string | yaml_double_quoted (std::string_view text) |
|
Formats a text as a YAML double-quoted scalar. More... | |
| std::string | yaml_scalar (std::string_view text) |
|
Formats a text as a YAML scalar, double-quoted only when needed. More... | |
Description
C++ source file with implementations for the µTest++ TAP test reporter member functions.
This source file contains the implementations for reporter_tap, a concrete implementation of the reporter abstract interface that formats test results according to the Test Anything Protocol (TAP), version 14. It is the default reporter, also selected with the --reporter=tap command-line option.
All definitions reside within the micro_os_plus::micro_test_plus::detail namespace, since the reporters are internal to the framework.
This file must be included when building the µTest++ library.
Functions
tap_text()
|
Prepares a text for a single TAP line.
Each line break (\\n, \\r, or the \\r\\n pair) is replaced by a space, so that the text does not end the line. When escape is true, each \\ is written as \\\\ and each # as \\#, as the TAP 14 specification recommends for the test point descriptions and the reasons, so that a # in the text does not start a directive (for example # TODO, which would hide a failure). The # Subtest: comments are not escaped, since the specification defines no escapes in comments, and the node-tap parser uses their text as it is.
- Parameters
-
text The text to prepare.
escape Whether to escape the \\ and # characters.
- Returns
The text, without line breaks, and escaped if requested.
Definition at line 104 of file reporter-tap.cpp.
Reference micro_os_plus::micro_test_plus::detail::anonymous{reporter-tap.cpp}::tap_text.
Referenced by micro_os_plus::micro_test_plus::detail::anonymous{reporter-tap.cpp}::tap_name::tap_name and micro_os_plus::micro_test_plus::detail::anonymous{reporter-tap.cpp}::tap_text.
yaml_double_quoted()
|
Formats a text as a YAML double-quoted scalar.
The text is enclosed in ", with each \\ written as \\\\, each " as \\", and each control character (including the line breaks, the tab, and DEL) as a YAML escape sequence (\\0, \\t, \\n, \\r, \\e, and so on, or \\xHH for the others), so that the value is a single line, and is valid YAML whatever it contains. As plain scalars, the values starting with {, [, or ', or containing : or #, would be rejected or truncated by the YAML parsers used by the TAP consumers. The bytes above 0x7F are written as they are, since they are expected to be parts of UTF-8 sequences.
- Parameters
-
text The text to format.
- Returns
The double-quoted scalar.
Definition at line 294 of file reporter-tap.cpp.
Reference micro_os_plus::micro_test_plus::detail::anonymous{reporter-tap.cpp}::yaml_double_quoted.
Referenced by micro_os_plus::micro_test_plus::detail::anonymous{reporter-tap.cpp}::yaml_double_quoted and micro_os_plus::micro_test_plus::detail::anonymous{reporter-tap.cpp}::yaml_scalar.
yaml_scalar()
|
Formats a text as a YAML scalar, double-quoted only when needed.
A text made only of letters, digits, and the characters _, ., +, /, and -, and not starting with -, is a valid plain scalar, whatever its meaning, and is returned unchanged, so that the usual values are written as before. Any other text, for example a file name with a space, a #, or a :, which a YAML parser would truncate, split, or reject as a plain scalar, is returned double-quoted, as yaml_double_quoted() does.
- Parameters
-
text The text to format.
- Returns
The scalar.
Definition at line 377 of file reporter-tap.cpp.
References micro_os_plus::micro_test_plus::detail::anonymous{reporter-tap.cpp}::yaml_double_quoted and micro_os_plus::micro_test_plus::detail::anonymous{reporter-tap.cpp}::yaml_scalar.
Referenced by micro_os_plus::micro_test_plus::detail::anonymous{reporter-tap.cpp}::yaml_scalar.
File Listing
The file content with the documentation metadata removed is:
Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.