From c8c5b8ac1a2ed76a800eab0e82babf8ba51a20d3 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 24 Mar 2023 13:58:45 +0100 Subject: [PATCH] tst_QDateTime::addMSecs(): check for failure after calling helper When the test failed, it did so in triplicate. Pick-to: 6.5 Change-Id: Ia871aed0a5960120a2659a6778c10dccd4b2953a Reviewed-by: Jason McDonald Reviewed-by: Thiago Macieira --- tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp index 1447d03054..dc3d3e0760 100644 --- a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp @@ -1610,10 +1610,15 @@ void tst_QDateTime::addMSecs() QCOMPARE(result.addMSecs(qint64(-nsecs) * 1000), dt); } }; +#define VERIFY(datum) \ + verify(datum); \ + if (QTest::currentTestFailed()) \ + return - verify(dt.addMSecs(qint64(nsecs) * 1000)); - verify(dt.addDuration(std::chrono::seconds(nsecs))); - verify(dt.addDuration(std::chrono::milliseconds(nsecs * 1000))); + VERIFY(dt.addMSecs(qint64(nsecs) * 1000)); + VERIFY(dt.addDuration(std::chrono::seconds(nsecs))); + VERIFY(dt.addDuration(std::chrono::milliseconds(nsecs * 1000))); +#undef VERIFY } #if QT_DEPRECATED_SINCE(6, 9)