summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-11-24 13:46:46 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-24 05:56:48 +0100
commitd34c8b55f34e6bb9394547718c9b333e5c44dce4 (patch)
treebb8f3d9056be89c382d4c9883114601f5d637820 /tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp
parentf32452e948cccfa9399b90448de11c5f08729a2c (diff)
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 <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp')
-rw-r--r--tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp32
1 files 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<void> f = createExceptionFuture();
- bool caught = false;
- try {
- f.waitForFinished();
- } catch (Exception &) {
- caught = true;
- }
- QVERIFY(caught);
+ QFuture<void> 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)