From 6b3da933dbcf52cd330f89a76a64d2afcd0638e4 Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 28 Dec 2023 20:41:15 -0700 Subject: [PATCH] Use non-zero return code when test cases are missing instead of exception --- TestResults/TestResults.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/TestResults/TestResults.cpp b/TestResults/TestResults.cpp index 73bc635..12eff02 100644 --- a/TestResults/TestResults.cpp +++ b/TestResults/TestResults.cpp @@ -104,7 +104,7 @@ void checkResults() } } -void reportResults(std::ostream &out) +int reportResults(std::ostream &out) { for (const std::string &warning : g_warnings) { @@ -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 &args) @@ -132,18 +133,17 @@ int main(const std::vector &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; } }