Skip to content

Commit

Permalink
Catch all exceptions from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cegonse committed Feb 22, 2023
1 parent 121c95b commit 637ffa7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions vendor/cest
Original file line number Diff line number Diff line change
Expand Up @@ -803,11 +803,9 @@ namespace cest
test_case->test_failed = true;
}

void handleTestException(TestCase *test_case, const std::exception& error)
void handleTestException(TestCase *test_case)
{
std::string exception_message("Unhandled exception in test case: ");

exception_message += error.what();
std::string exception_message("Unhandled exception in test case");

appendAssertionFailure(&assertion_failures, exception_message, test_case->file, test_case->line);
handleFailedTest(test_case);
Expand Down Expand Up @@ -968,8 +966,8 @@ int main(int argc, const char *argv[])

printTestResult(test_case);
continue;
} catch (const std::exception& error) {
handleTestException(test_case, error);
} catch (...) {
handleTestException(test_case);
}

if (after_each) {
Expand Down

0 comments on commit 637ffa7

Please sign in to comment.