MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / AssertThrow

Function AssertThrow

TestHelper/Tools.hpp:42–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 //-------------------------------------------------------------------------
41 template <typename ExceptionType, typename Fct>
42 void AssertThrow(Fct fct,
43 std::function<void(const ExceptionType&)> exceptionCheck)
44 {
45 try
46 {
47 fct();
48 }
49 catch (const ExceptionType& e)
50 {
51 exceptionCheck(e);
52 return;
53 }
54 catch (...)
55 {
56 throw std::runtime_error("Expected exception not raised.");
57 }
58 throw std::runtime_error("No exception raised.");
59 }
60}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected