QtTest: mark more functions as cold
Unit test failure should not happen, so mark failure formatters as cold (like qFail() itself). As a drive-by, mark formatFailMessage() overloads file-static, too. Change-Id: I92f5b674a7282f4ebaa9250894a9971a524f4108 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 69c510d6bcc52ac133a82d7a9493ffba037c4521) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
0f89dbb571
commit
a58abfec1c
@ -315,8 +315,9 @@ namespace QTest
|
|||||||
Q_TESTLIB_EXPORT void maybeThrowOnFail();
|
Q_TESTLIB_EXPORT void maybeThrowOnFail();
|
||||||
Q_TESTLIB_EXPORT void maybeThrowOnSkip();
|
Q_TESTLIB_EXPORT void maybeThrowOnSkip();
|
||||||
|
|
||||||
|
Q_DECL_COLD_FUNCTION
|
||||||
Q_TESTLIB_EXPORT QString formatTryTimeoutDebugMessage(q_no_char8_t::QUtf8StringView expr, int timeout, int actual);
|
Q_TESTLIB_EXPORT QString formatTryTimeoutDebugMessage(q_no_char8_t::QUtf8StringView expr, int timeout, int actual);
|
||||||
Q_TESTLIB_EXPORT
|
Q_TESTLIB_EXPORT Q_DECL_COLD_FUNCTION
|
||||||
const char *formatPropertyTestHelperFailure(char *msg, size_t maxMsgLen,
|
const char *formatPropertyTestHelperFailure(char *msg, size_t maxMsgLen,
|
||||||
const char *actual, const char *expected,
|
const char *actual, const char *expected,
|
||||||
const char *actualExpr,
|
const char *actualExpr,
|
||||||
|
@ -342,6 +342,7 @@ static int approx_wide_len(const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Overload to format failures for "const char *" - no need to strdup().
|
// Overload to format failures for "const char *" - no need to strdup().
|
||||||
|
static Q_DECL_COLD_FUNCTION
|
||||||
void formatFailMessage(char *msg, size_t maxMsgLen,
|
void formatFailMessage(char *msg, size_t maxMsgLen,
|
||||||
const char *failureMsg,
|
const char *failureMsg,
|
||||||
const char *val1, const char *val2,
|
const char *val1, const char *val2,
|
||||||
@ -380,6 +381,7 @@ QTest::Internal::formatPropertyTestHelperFailure(char *msg, size_t maxMsgLen,
|
|||||||
|
|
||||||
// Format failures using the toString() template
|
// Format failures using the toString() template
|
||||||
template <class Actual, class Expected>
|
template <class Actual, class Expected>
|
||||||
|
static Q_DECL_COLD_FUNCTION
|
||||||
void formatFailMessage(char *msg, size_t maxMsgLen,
|
void formatFailMessage(char *msg, size_t maxMsgLen,
|
||||||
const char *failureMsg,
|
const char *failureMsg,
|
||||||
const Actual &val1, const Expected &val2,
|
const Actual &val1, const Expected &val2,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user