Skip to content

Commit

Permalink
Use non-zero return code when test cases are missing instead of excep…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
LegalizeAdulthood committed Dec 29, 2023
1 parent dbf5036 commit 6b3da93
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions TestResults/TestResults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void checkResults()
}
}

void reportResults(std::ostream &out)
int reportResults(std::ostream &out)
{
for (const std::string &warning : g_warnings)
{
Expand All @@ -116,8 +116,9 @@ void reportResults(std::ostream &out)
{
std::cerr << error << '\n';
}
throw std::runtime_error("errors found");
return 1;
}
return 0;
}

int main(const std::vector<std::string_view> &args)
Expand All @@ -132,18 +133,17 @@ int main(const std::vector<std::string_view> &args)
g_errors = testCases::scanTestDirectory(args[1]);
scanResultsFile(args[2]);
checkResults();
reportResults(std::cout);
return 0;
return reportResults(std::cout);
}
catch (const std::exception &bang)
{
std::cerr << "Unexpected exception: " << bang.what() << '\n';
return 1;
return 2;
}
catch (...)
{
std::cerr << "Unknown exception\n";
return 2;
return 3;
}
}

Expand Down

0 comments on commit 6b3da93

Please sign in to comment.