| 277 | } |
| 278 | |
| 279 | NGTest::TFlags NGTest::ParseFlags(int argc, char** argv) { |
| 280 | TFlags result; |
| 281 | |
| 282 | std::ostringstream filtersPos; |
| 283 | std::string_view filterPosSep = ""; |
| 284 | std::ostringstream filtersNeg; |
| 285 | std::string_view filterNegSep = ""; |
| 286 | |
| 287 | if (argc > 0) { |
| 288 | result.GtestArgv.push_back(argv[0]); |
| 289 | } |
| 290 | |
| 291 | for (int i = 1; i < argc; ++i) { |
| 292 | auto name = argv[i]; |
| 293 | |
| 294 | if (strcmp(name, "--help") == 0) { |
| 295 | result.GtestArgv.push_back(name); |
| 296 | break; |
| 297 | } else if (StartsWith(name, "--gtest_") || StartsWith(name, "--gmock_")) { |
| 298 | result.GtestArgv.push_back(name); |
| 299 | } else if (strcmp(name, "--list") == 0 || strcmp(name, "-l") == 0) { |
| 300 | result.ListLevel = std::max(result.ListLevel, 1); |
| 301 | } else if (strcmp(name, "--list-verbose") == 0) { |
| 302 | result.ListLevel = std::max(result.ListLevel, 2); |
| 303 | } else if (strcmp(name, "--print-before-suite") == 0) { |
| 304 | Unsupported("--print-before-suite"); |
| 305 | } else if (strcmp(name, "--print-before-test") == 0) { |
| 306 | Unsupported("--print-before-test"); |
| 307 | } else if (strcmp(name, "--show-fails") == 0) { |
| 308 | Unsupported("--show-fails"); |
| 309 | } else if (strcmp(name, "--dont-show-fails") == 0) { |
| 310 | Unsupported("--dont-show-fails"); |
| 311 | } else if (strcmp(name, "--print-times") == 0) { |
| 312 | Unsupported("--print-times"); |
| 313 | } else if (strcmp(name, "--from") == 0) { |
| 314 | Unsupported("--from"); |
| 315 | } else if (strcmp(name, "--to") == 0) { |
| 316 | Unsupported("--to"); |
| 317 | } else if (strcmp(name, "--fork-tests") == 0) { |
| 318 | Unsupported("--fork-tests"); |
| 319 | } else if (strcmp(name, "--is-forked-internal") == 0) { |
| 320 | Unsupported("--is-forked-internal"); |
| 321 | } else if (strcmp(name, "--loop") == 0) { |
| 322 | Unsupported("--loop"); |
| 323 | } else if (strcmp(name, "--trace-path") == 0 || strcmp(name, "--trace-path-append") == 0) { |
| 324 | ++i; |
| 325 | |
| 326 | if (i >= argc) { |
| 327 | std::cerr << "Missing value for argument --trace-path" << std::endl; |
| 328 | exit(2); |
| 329 | } else if (!result.TracePath.empty()) { |
| 330 | std::cerr << "Multiple --trace-path or --trace-path-append given" << std::endl; |
| 331 | exit(2); |
| 332 | } |
| 333 | |
| 334 | result.TracePath = argv[i]; |
| 335 | result.AppendTrace = strcmp(name, "--trace-path-append") == 0; |
| 336 | } else if (strcmp(name, "--list-path") == 0) { |
nothing calls this directly
no test coverage detected