the Compartmented Robust Posix C++ Unit Test system |
|
---|
This environment variable controls experimental support for decorations in human readable test reports (i.e. non XML reports.) It is typically used for colourizing the output, but is not specialized for it.
The syntax (subject to change) is:
CRPCUT_TEXT_DECORATION = SEPARATOR VALUE DECORATORLIST SEPARATOR SEPARATOR = char VALUE = [^SEPARATOR]+ DECORATORLIST = | DECORATORDEF SEPARATOR DECORATORLIST DECORATORDEF = DECORATORNAME '=' VALUE DECORATORNAME = 'PASSED' | 'FAILED' | 'NCPASSED' /* defaults to same as PASSED */ | 'NCFAILED' /* defaults to same as FAILED */ | 'BLOCKED' | 'PASSED_SUM' /* defaults to same as PASSED */ | 'FAILED_SUM' /* defaults to same as FAILED */ | 'NCPASSED_SUM' /* defaults to same as NCPASSED */ | 'NCFAILED_SUM' /* defaults to same as NCFAILED */ | 'BLOCKED_SUM' /* defaults to same as BLOCKED */
SEPARATOR
can be any character that is not used in
any value, and is repeated between each decorator definition.
The first value is the reset value, a string printed at the end of every section. The other value are:
FAILED
NCFAILED
FAILED
if not specified.PASSED
NCPASSED
PASSED
ifnot specified.BLOCKED
FAILED_SUM
FAILED
if not specified.NCFAILED_SUM
NCFAILED
if not specified.PASSED_SUM
PASSED
if not specified.NCPASSED_SUM
NCPASSED
if not specified.BLOCKED_SUM
BLOCKED
if not specified.
An example using ANSI-escapes in bash-syntax:
$> export CRPCUT_TEXT_DECORATION=$' \E[0m BLOCKED=\E[35m PASSED=\E[32m FAILED=\E[31m NCFAILED=\E[33m PASSED_SUM=\E[42m\E[37m\E[1m FAILED_SUM=\E[41m\E[37m\E[1m BLOCKED_SUM=\E[45m\E[37m\E[1m '
This uses the reset sequence \x1b[0m
as the reset
value. Blocked tests are printed purple.
Passed tests (both critical and non-critical) are coloured green using
the escape sequence \x1b[32m
.
Failed critical tests are coloured red using the escape sequence
\x1b[31m
, and non-critital tests are printed in
yellow with the \x1b[33m
.
In the summary, all lines use the corresponding colours, but printed
inverse with bold white text.
An example test report has, with possible differences in colour representation, the following appearence:
PASSED!: basics::construct info--------------------------------------------------------------------------- /home/bjorn/devel/crpcut/doc-src/samples/report_example.cpp:51 created an A, addr=0x639860 =============================================================================== FAILED!: basics::call_func phase="running" -------------------------------------------------------------- /home/bjorn/devel/crpcut/doc-src/samples/report_example.cpp:56 ASSERT_TRUE(func() == 1) is evaluated as: 3 == 1 ------------------------------------------------------------------------------- =============================================================================== FAILED?: basics::destroy info--------------------------------------------------------------------------- /home/bjorn/devel/crpcut/doc-src/samples/report_example.cpp:61 running test body ------------------------------------------------------------------------------- /tmp/crpcutSOimFW/basics::destroy is not empty! phase="destroying" ----------------------------------------------------------- /home/bjorn/devel/crpcut/doc-src/samples/report_example.cpp:59 Died with core dump ------------------------------------------------------------------------------- =============================================================================== Files remain under /tmp/crpcutSOimFW The following tests were blocked from running: -basics::will_not_run !toy::work 5 test cases selected tag run passed failed !a_tag 2 1 1 ?another_tag 1 0 1 Sum Critical Non-critical PASSED : 1 1 0 FAILED : 2 1 1 UNTESTED : 2