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