Skip semicolon after uses of QTRY_IMPL() and QTRY_LOOP_IMPL()
The macros' expansions end with an if-block and a for-block, respectively, so the following semicolon is superfluous. Since we control these macros' use (they're internals), just skip the semicolons, rather than wrapping their bodies in do-while(0). Pick-to: 6.4 Change-Id: I53f7786a66a0dc7709ac9f96d49985edafceec39 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
parent
4048efc80c
commit
a670a00aed
@ -163,10 +163,11 @@ inline void useVerifyThrowsException() {}
|
|||||||
&& !(expr); qt_test_i += step) { \
|
&& !(expr); qt_test_i += step) { \
|
||||||
QTest::qWait(step); \
|
QTest::qWait(step); \
|
||||||
}
|
}
|
||||||
|
// Ends in a for-block, so doesn't want a following semicolon.
|
||||||
|
|
||||||
#define QTRY_TIMEOUT_DEBUG_IMPL(expr, timeoutValue, step) \
|
#define QTRY_TIMEOUT_DEBUG_IMPL(expr, timeoutValue, step) \
|
||||||
if (!QTest::currentTestFailed() && !(expr)) { \
|
if (!QTest::currentTestFailed() && !(expr)) { \
|
||||||
QTRY_LOOP_IMPL((expr), 2 * (timeoutValue), step); \
|
QTRY_LOOP_IMPL((expr), 2 * (timeoutValue), step) \
|
||||||
if (expr) { \
|
if (expr) { \
|
||||||
QFAIL(qPrintable(QTest::Internal::formatTryTimeoutDebugMessage(\
|
QFAIL(qPrintable(QTest::Internal::formatTryTimeoutDebugMessage(\
|
||||||
u8"" #expr, timeoutValue, timeoutValue + qt_test_i))); \
|
u8"" #expr, timeoutValue, timeoutValue + qt_test_i))); \
|
||||||
@ -176,13 +177,14 @@ inline void useVerifyThrowsException() {}
|
|||||||
#define QTRY_IMPL(expr, timeout)\
|
#define QTRY_IMPL(expr, timeout)\
|
||||||
const int qt_test_step = timeout < 350 ? timeout / 7 + 1 : 50; \
|
const int qt_test_step = timeout < 350 ? timeout / 7 + 1 : 50; \
|
||||||
const int qt_test_timeoutValue = timeout; \
|
const int qt_test_timeoutValue = timeout; \
|
||||||
{ QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); } \
|
{ QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step) } \
|
||||||
QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)
|
QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)
|
||||||
|
// Ends with an if-block, so doesn't want a following semicolon.
|
||||||
|
|
||||||
// Will try to wait for the expression to become true while allowing event processing
|
// Will try to wait for the expression to become true while allowing event processing
|
||||||
#define QTRY_VERIFY_WITH_TIMEOUT(expr, timeout) \
|
#define QTRY_VERIFY_WITH_TIMEOUT(expr, timeout) \
|
||||||
do { \
|
do { \
|
||||||
QTRY_IMPL((expr), timeout);\
|
QTRY_IMPL((expr), timeout) \
|
||||||
QVERIFY(expr); \
|
QVERIFY(expr); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
@ -191,7 +193,7 @@ do { \
|
|||||||
// Will try to wait for the expression to become true while allowing event processing
|
// Will try to wait for the expression to become true while allowing event processing
|
||||||
#define QTRY_VERIFY2_WITH_TIMEOUT(expr, messageExpression, timeout) \
|
#define QTRY_VERIFY2_WITH_TIMEOUT(expr, messageExpression, timeout) \
|
||||||
do { \
|
do { \
|
||||||
QTRY_IMPL((expr), timeout);\
|
QTRY_IMPL((expr), timeout) \
|
||||||
QVERIFY2(expr, messageExpression); \
|
QVERIFY2(expr, messageExpression); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
@ -200,7 +202,7 @@ do { \
|
|||||||
// Will try to wait for the comparison to become successful while allowing event processing
|
// Will try to wait for the comparison to become successful while allowing event processing
|
||||||
#define QTRY_COMPARE_WITH_TIMEOUT(expr, expected, timeout) \
|
#define QTRY_COMPARE_WITH_TIMEOUT(expr, expected, timeout) \
|
||||||
do { \
|
do { \
|
||||||
QTRY_IMPL(((expr) == (expected)), timeout);\
|
QTRY_IMPL(((expr) == (expected)), timeout) \
|
||||||
QCOMPARE((expr), expected); \
|
QCOMPARE((expr), expected); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
@ -208,7 +210,7 @@ do { \
|
|||||||
|
|
||||||
#define QTRY_COMPARE_OP_WITH_TIMEOUT_IMPL(left, right, op, opId, timeout) \
|
#define QTRY_COMPARE_OP_WITH_TIMEOUT_IMPL(left, right, op, opId, timeout) \
|
||||||
do { \
|
do { \
|
||||||
QTRY_IMPL(((left) op (right)), timeout); \
|
QTRY_IMPL(((left) op (right)), timeout) \
|
||||||
QCOMPARE_OP_IMPL(left, right, op, opId); \
|
QCOMPARE_OP_IMPL(left, right, op, opId); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user