MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / assertNoThrowFail

Method assertNoThrowFail

test/fixture.cpp:313–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311}
312
313void TestFixture::assertNoThrowFail(const char * const filename, const unsigned int linenr, bool bailout) const
314{
315 std::string ex_msg;
316
317 try {
318 // cppcheck-suppress rethrowNoCurrentException
319 throw;
320 }
321 catch (const AssertFailedError&) {
322 return;
323 }
324 catch (const InternalError& e) {
325 ex_msg = e.errorMessage;
326 }
327 catch (const std::exception& e) {
328 ex_msg = e.what();
329 }
330 catch (...) {
331 ex_msg = "unknown exception";
332 }
333
334 ++fails_counter;
335 errmsg << getLocationStr(filename, linenr) << ": Assertion failed. "
336 << "Unexpected exception was thrown: " << ex_msg << std::endl << "_____" << std::endl;
337 if (bailout)
338 throw AssertFailedError();
339}
340
341void TestFixture::printHelp()
342{

Callers

nothing calls this directly

Calls 1

AssertFailedErrorClass · 0.85

Tested by

no test coverage detected