Commit 89be3424 authored by Don Gagne's avatar Don Gagne

Support --unittest::testname

Allows you to run a single unit test from the command line
parent 34414960
......@@ -112,8 +112,8 @@ int main(int argc, char *argv[])
bool quietWindowsAsserts = false; // Don't let asserts pop dialog boxes
CmdLineOpt_t rgCmdLineOptions[] = {
{ "--unittest", &runUnitTests },
{ "--no-windows-assert-ui", &quietWindowsAsserts },
{ "--unittest", &runUnitTests, QString() },
{ "--no-windows-assert-ui", &quietWindowsAsserts, QString() },
// Add additional command line option flags here
};
......@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
}
// Run the test
int failures = AutoTest::run(argc-1, argv);
int failures = AutoTest::run(argc-1, argv, rgCmdLineOptions[0].optionArg);
if (failures == 0)
{
qDebug() << "ALL TESTS PASSED";
......
......@@ -49,14 +49,16 @@ namespace AutoTest
}
}
inline int run(int argc, char *argv[])
inline int run(int argc, char *argv[], QString& singleTest)
{
int ret = 0;
foreach (QObject* test, testList())
{
qgcApp()->destroySingletonsForUnitTest();
qgcApp()->createSingletonsForUnitTest();
ret += QTest::qExec(test, argc, argv);
if (singleTest.isEmpty() || singleTest == test->objectName()) {
qgcApp()->destroySingletonsForUnitTest();
qgcApp()->createSingletonsForUnitTest();
ret += QTest::qExec(test, argc, argv);
}
}
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment