mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Try/catch for unit test main
This commit is contained in:
@@ -14,11 +14,11 @@ TEMPLATE = app
|
||||
DEPENDPATH += \
|
||||
. \
|
||||
$$SourceRoot/src \
|
||||
$$SourceRoot/tests \
|
||||
$$SourceRoot/tests
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$SourceRoot/src \
|
||||
$$SourceRoot/tests \
|
||||
$$SourceRoot/tests
|
||||
|
||||
HEADERS += *.h
|
||||
SOURCES += *.cpp
|
||||
|
||||
18
tests/test.h
18
tests/test.h
@@ -49,8 +49,12 @@ args.append({ "-o", resultsFileName + "_testresults.xml,xml" }); \
|
||||
#define BLACKTEST_APPLESS_MAIN(TestObject) \
|
||||
int main(int argc, char *argv[]) \
|
||||
{ \
|
||||
BLACKTEST_INIT(TestObject) \
|
||||
return QTest::qExec(&to, args); \
|
||||
try { \
|
||||
BLACKTEST_INIT(TestObject) \
|
||||
return QTest::qExec(&to, args); \
|
||||
} catch (...) { \
|
||||
return EXIT_FAILURE; \
|
||||
} \
|
||||
}
|
||||
|
||||
//! Implements a main() function that executes all tests in TestObject
|
||||
@@ -59,9 +63,13 @@ int main(int argc, char *argv[]) \
|
||||
#define BLACKTEST_MAIN(TestObject) \
|
||||
int main(int argc, char *argv[]) \
|
||||
{ \
|
||||
QCoreApplication app(argc, argv); \
|
||||
BLACKTEST_INIT(TestObject) \
|
||||
return QTest::qExec(&to, args); \
|
||||
try { \
|
||||
QCoreApplication app(argc, argv); \
|
||||
BLACKTEST_INIT(TestObject) \
|
||||
return QTest::qExec(&to, args); \
|
||||
} catch (...) { \
|
||||
return EXIT_FAILURE; \
|
||||
} \
|
||||
}
|
||||
|
||||
//! \endcond
|
||||
|
||||
Reference in New Issue
Block a user