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