Commit 436b30c6 authored by Don Gagne's avatar Don Gagne

Changed option loading mechanism

parent 60099c12
...@@ -51,7 +51,9 @@ void ParseCmdLineOptions(int& argc, ///< count of ar ...@@ -51,7 +51,9 @@ void ParseCmdLineOptions(int& argc, ///< count of ar
if (arg.startsWith(QString("%1:").arg(optionStr), Qt::CaseInsensitive)) { if (arg.startsWith(QString("%1:").arg(optionStr), Qt::CaseInsensitive)) {
found = true; found = true;
prgOpts[iOption].optionArg = arg.right(arg.length() - (optionStr.length() + 1)); if (prgOpts[iOption].optionArg) {
*prgOpts[iOption].optionArg = arg.right(arg.length() - (optionStr.length() + 1));
}
} else if (arg.compare(optionStr, Qt::CaseInsensitive) == 0) { } else if (arg.compare(optionStr, Qt::CaseInsensitive) == 0) {
found = true; found = true;
} }
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
typedef struct { typedef struct {
const char* optionStr; ///< command line option, for example "--foo" const char* optionStr; ///< command line option, for example "--foo"
bool* optionFound; ///< if option is found this variable will be set to true bool* optionFound; ///< if option is found this variable will be set to true
QString optionArg; ///< Option has additional argument, form is option:arg QString* optionArg; ///< Option has additional argument, form is option:arg
} CmdLineOpt_t; } CmdLineOpt_t;
void ParseCmdLineOptions(int& argc, void ParseCmdLineOptions(int& argc,
......
...@@ -135,9 +135,10 @@ int main(int argc, char *argv[]) ...@@ -135,9 +135,10 @@ int main(int argc, char *argv[])
bool quietWindowsAsserts = false; // Don't let asserts pop dialog boxes bool quietWindowsAsserts = false; // Don't let asserts pop dialog boxes
QString unitTestOptions;
CmdLineOpt_t rgCmdLineOptions[] = { CmdLineOpt_t rgCmdLineOptions[] = {
{ "--unittest", &runUnitTests, QString() }, { "--unittest", &runUnitTests, &unitTestOptions },
{ "--no-windows-assert-ui", &quietWindowsAsserts, QString() }, { "--no-windows-assert-ui", &quietWindowsAsserts, NULL },
// Add additional command line option flags here // Add additional command line option flags here
}; };
...@@ -181,7 +182,7 @@ int main(int argc, char *argv[]) ...@@ -181,7 +182,7 @@ int main(int argc, char *argv[])
} }
// Run the test // Run the test
int failures = UnitTest::run(rgCmdLineOptions[0].optionArg); int failures = UnitTest::run(unitTestOptions);
if (failures == 0) { if (failures == 0) {
qDebug() << "ALL TESTS PASSED"; qDebug() << "ALL TESTS PASSED";
} else { } else {
......
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