mirror of https://github.com/qt/qtbase.git
TAP test logger: avoid dangling space on TODO and SKIP lines
If an incident has an empty description we produced output with a dangling space. Avoid triggering the inanity 'bot with those. Reorganise the code to save some duplication. Change-Id: I1dc29fa8ad4449a4584f11dddcf002e405cd9238 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
98a42b1627
commit
6729a4b29c
|
@ -125,14 +125,28 @@ void QTapTestLogger::addIncident(IncidentTypes type, const char *description,
|
|||
bool ok = type == Pass || type == BlacklistedPass || type == Skip
|
||||
|| type == XPass || type == BlacklistedXPass;
|
||||
|
||||
QTestCharBuffer directive;
|
||||
if (type == XFail || type == XPass || type == BlacklistedFail || type == BlacklistedPass
|
||||
|| type == BlacklistedXFail || type == BlacklistedXPass) {
|
||||
const char *const incident = [type]() {
|
||||
switch (type) {
|
||||
// We treat expected or blacklisted failures/passes as TODO-failures/passes,
|
||||
// which should be treated as soft issues by consumers. Not all do though :/
|
||||
QTest::qt_asprintf(&directive, " # TODO %s", description);
|
||||
} else if (type == Skip) {
|
||||
QTest::qt_asprintf(&directive, " # SKIP %s", description);
|
||||
case BlacklistedPass:
|
||||
case XFail: case BlacklistedXFail:
|
||||
case XPass: case BlacklistedXPass:
|
||||
case BlacklistedFail:
|
||||
return "TODO";
|
||||
case Skip:
|
||||
return "SKIP";
|
||||
case Pass:
|
||||
case Fail:
|
||||
break;
|
||||
}
|
||||
return static_cast<const char *>(nullptr);
|
||||
}();
|
||||
|
||||
QTestCharBuffer directive;
|
||||
if (incident) {
|
||||
QTest::qt_asprintf(&directive, " # %s%s%s", incident,
|
||||
qstrlen(description) ? " " : "", description);
|
||||
}
|
||||
|
||||
int testNumber = QTestLog::totalCount();
|
||||
|
|
|
@ -2,7 +2,7 @@ TAP version 13
|
|||
# tst_Blacklisted
|
||||
ok 1 - initTestCase()
|
||||
# This test should BPASS
|
||||
ok 2 - pass() # TODO
|
||||
ok 2 - pass() # TODO
|
||||
ok 3 - skip() # SKIP This test should SKIP
|
||||
not ok 4 - fail() # TODO 'false' returned FALSE. (This test should BFAIL)
|
||||
---
|
||||
|
|
Loading…
Reference in New Issue