MCPcopy Create free account
hub / github.com/SOUI2/soui / runCommandLine

Method runCommandLine

third-part/jsoncpp/src/test_lib_json/jsontest.cpp:325–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325int Runner::runCommandLine(int argc, const char* argv[]) const {
326 // typedef std::deque<JSONCPP_STRING> TestNames;
327 Runner subrunner;
328 for (int index = 1; index < argc; ++index) {
329 JSONCPP_STRING opt = argv[index];
330 if (opt == "--list-tests") {
331 listTests();
332 return 0;
333 } else if (opt == "--test-auto") {
334 preventDialogOnCrash();
335 } else if (opt == "--test") {
336 ++index;
337 if (index < argc) {
338 unsigned int testNameIndex;
339 if (testIndex(argv[index], testNameIndex)) {
340 subrunner.add(tests_[testNameIndex]);
341 } else {
342 fprintf(stderr, "Test '%s' does not exist!\n", argv[index]);
343 return 2;
344 }
345 } else {
346 printUsage(argv[0]);
347 return 2;
348 }
349 } else {
350 printUsage(argv[0]);
351 return 2;
352 }
353 }
354 bool succeeded;
355 if (subrunner.testCount() > 0) {
356 succeeded = subrunner.runAllTest(subrunner.testCount() > 1);
357 } else {
358 succeeded = runAllTest(true);
359 }
360 return succeeded ? 0 : 1;
361}
362
363#if defined(_MSC_VER) && defined(_DEBUG)
364// Hook MSVCRT assertions to prevent dialog from appearing

Callers 1

mainFunction · 0.80

Calls 4

testCountMethod · 0.80
runAllTestMethod · 0.80
printUsageFunction · 0.50
addMethod · 0.45

Tested by

no test coverage detected