tst_QPromise: fix handling of failures from nested functions

The commit 1f22fc995a36193cd67e8190858bb33614d149f4 introduced nested
functions without properly checking their return status with
QTest::currentTestFailed().
Later, commit 855c4484693015cb6498f2183d95de1377d49898 used the same
pattern.

Fix all the affected tests by wrapping the function calls into the
pre-existing RUN_TEST_FUNC macro.

Both commits were picked to 6.5, so do the same with this patch.

Pick-to: 6.5
Change-Id: I3e11bf5724d9b89c75a4e5c73c96f9566c36b5cd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 4c00337ccb8e4266fa5a4af4fba40e5b62aba81b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ivan Solovev 2024-11-06 17:53:13 +01:00 committed by Qt Cherry-pick Bot
parent d2ee5811d0
commit 8478831214

View File

@ -559,10 +559,10 @@ static inline void testCancelWhenDestroyedWithoutStarting()
void tst_QPromise::cancelWhenDestroyedWithoutStarting() void tst_QPromise::cancelWhenDestroyedWithoutStarting()
{ {
testCancelWhenDestroyedWithoutStarting<void>(); RUN_TEST_FUNC(testCancelWhenDestroyedWithoutStarting<void>);
testCancelWhenDestroyedWithoutStarting<int>(); RUN_TEST_FUNC(testCancelWhenDestroyedWithoutStarting<int>);
testCancelWhenDestroyedWithoutStarting<CopyOnlyType>(); RUN_TEST_FUNC(testCancelWhenDestroyedWithoutStarting<CopyOnlyType>);
testCancelWhenDestroyedWithoutStarting<MoveOnlyType>(); RUN_TEST_FUNC(testCancelWhenDestroyedWithoutStarting<MoveOnlyType>);
} }
template <typename T> template <typename T>
@ -582,10 +582,10 @@ static inline void testCancelWhenDestroyedRunsContinuations()
void tst_QPromise::cancelWhenDestroyedRunsContinuations() void tst_QPromise::cancelWhenDestroyedRunsContinuations()
{ {
testCancelWhenDestroyedRunsContinuations<void>(); RUN_TEST_FUNC(testCancelWhenDestroyedRunsContinuations<void>);
testCancelWhenDestroyedRunsContinuations<int>(); RUN_TEST_FUNC(testCancelWhenDestroyedRunsContinuations<int>);
testCancelWhenDestroyedRunsContinuations<CopyOnlyType>(); RUN_TEST_FUNC(testCancelWhenDestroyedRunsContinuations<CopyOnlyType>);
testCancelWhenDestroyedRunsContinuations<MoveOnlyType>(); RUN_TEST_FUNC(testCancelWhenDestroyedRunsContinuations<MoveOnlyType>);
} }
template <typename T> template <typename T>
@ -606,10 +606,10 @@ static inline void testCancelWhenDestroyedWithFailureHandler()
void tst_QPromise::cancelWhenDestroyedWithFailureHandler() void tst_QPromise::cancelWhenDestroyedWithFailureHandler()
{ {
#ifndef QT_NO_EXCEPTIONS #ifndef QT_NO_EXCEPTIONS
testCancelWhenDestroyedWithFailureHandler<void>(); RUN_TEST_FUNC(testCancelWhenDestroyedWithFailureHandler<void>);
testCancelWhenDestroyedWithFailureHandler<int>(); RUN_TEST_FUNC(testCancelWhenDestroyedWithFailureHandler<int>);
testCancelWhenDestroyedWithFailureHandler<CopyOnlyType>(); RUN_TEST_FUNC(testCancelWhenDestroyedWithFailureHandler<CopyOnlyType>);
testCancelWhenDestroyedWithFailureHandler<MoveOnlyType>(); RUN_TEST_FUNC(testCancelWhenDestroyedWithFailureHandler<MoveOnlyType>);
#else #else
QSKIP("Exceptions are disabled, skipping the test"); QSKIP("Exceptions are disabled, skipping the test");
#endif #endif
@ -634,10 +634,10 @@ static inline void testContinuationsRunWhenFinished()
void tst_QPromise::continuationsRunWhenFinished() void tst_QPromise::continuationsRunWhenFinished()
{ {
testContinuationsRunWhenFinished<void>(); RUN_TEST_FUNC(testContinuationsRunWhenFinished<void>);
testContinuationsRunWhenFinished<int>(); RUN_TEST_FUNC(testContinuationsRunWhenFinished<int>);
testContinuationsRunWhenFinished<CopyOnlyType>(); RUN_TEST_FUNC(testContinuationsRunWhenFinished<CopyOnlyType>);
testContinuationsRunWhenFinished<MoveOnlyType>(); RUN_TEST_FUNC(testContinuationsRunWhenFinished<MoveOnlyType>);
} }
void tst_QPromise::finishWhenSwapped() void tst_QPromise::finishWhenSwapped()
@ -716,10 +716,10 @@ void testCancelWhenMoved()
void tst_QPromise::cancelWhenMoved() void tst_QPromise::cancelWhenMoved()
{ {
testCancelWhenMoved<void>(); RUN_TEST_FUNC(testCancelWhenMoved<void>);
testCancelWhenMoved<int>(); RUN_TEST_FUNC(testCancelWhenMoved<int>);
testCancelWhenMoved<CopyOnlyType>(); RUN_TEST_FUNC(testCancelWhenMoved<CopyOnlyType>);
testCancelWhenMoved<MoveOnlyType>(); RUN_TEST_FUNC(testCancelWhenMoved<MoveOnlyType>);
} }
void tst_QPromise::waitUntilResumed() void tst_QPromise::waitUntilResumed()