| 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:
FAILEDNCFAILEDFAILED if not specified.PASSEDNCPASSEDPASSED ifnot specified.BLOCKEDFAILED_SUMFAILED if not specified.NCFAILED_SUMNCFAILED if not specified.PASSED_SUMPASSED if not specified.NCPASSED_SUMNCPASSED if not specified.BLOCKED_SUMBLOCKED 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---------------------------------------------------------------------------
created an A, addr=0x8b0300
===============================================================================
FAILED!: basics::call_func
phase="running" --------------------------------------------------------------
/home/bjorn/devel/crpcut/doc-src/samples/report_example.cpp:51
ASSERT_TRUE(func() == 1)
is evaluated as:
3 == 1
-------------------------------------------------------------------------------
===============================================================================
FAILED?: basics::destroy
info---------------------------------------------------------------------------
running test body
-------------------------------------------------------------------------------
/tmp/crpcutD9lHEo/basics::destroy is not empty!
phase="destroying" -----------------------------------------------------------
Died with core dump
-------------------------------------------------------------------------------
===============================================================================
Files remain under /tmp/crpcutD9lHEo
The following tests were blocked from running:
toy::work
4 test cases selected
tag run passed failed
!a_tag 2 1 1
?another_tag 1 0 1
Total : Sum Critical Non-critical
PASSED : 1 1 0
FAILED : 2 1 1
UNTESTED : 1