From d34c8b55f34e6bb9394547718c9b333e5c44dce4 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 24 Nov 2011 13:46:46 +1000 Subject: Only use QVERIFY in test functions. The modified test was using QVERIFY in the destructor of a local class, but QVERIFY should only be used directly in a test function. This commit changes the local class to record the result of the test and verifies that result in the test function. Change-Id: Ie68ac6aa880368c961ebfa67cd452f0fbf26db89 Reviewed-by: Rohan McGovern --- .../corelib/concurrent/qfuture/tst_qfuture.cpp | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp b/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp index 3e876cb848..0b3eb90819 100644 --- a/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp +++ b/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp @@ -1404,34 +1404,34 @@ void tst_QFuture::exceptions() } } - -void tst_QFuture::exceptions_QTBUG18149() +class MyClass { - class MyClass +public: + ~MyClass() { - public: - ~MyClass() - { - QFuture f = createExceptionFuture(); - bool caught = false; - try { - f.waitForFinished(); - } catch (Exception &) { - caught = true; - } - QVERIFY(caught); + QFuture f = createExceptionFuture(); + try { + f.waitForFinished(); + } catch (Exception &) { + caught = true; } - }; + } + static bool caught; +}; +bool MyClass::caught = false; + +void tst_QFuture::exceptions_QTBUG18149() +{ try { MyClass m; Q_UNUSED(m); throw 0; } catch (int) {} + QVERIFY(MyClass::caught); } - #endif // QT_NO_EXCEPTIONS QTEST_MAIN(tst_QFuture) -- cgit v1.2.3