Boost C++ Libraries: Ticket #12800: BOOST_CHECK_THROW does not catch unrelated exception type https://svn.boost.org/trac10/ticket/12800 <p> The following code: </p> <pre class="wiki">#define BOOST_TEST_MODULE qengine_mapping #include &lt;boost/test/included/unit_test.hpp&gt; BOOST_AUTO_TEST_CASE( test ) { try { BOOST_CHECK_THROW( throw 1, std::exception ); } catch( ... ) { } } </pre><p> Produces "No errors detected". The documentation for <code>BOOST_CHECK_THROW</code> states that: <em>If the statement throw any other unrelated exception or doesn't throw at all, check fails.</em>. It is my understanding that <code></code>check fails<code></code> implies the creation of some log report, which is not the case. </p> <p> I believe that <code>BOOST_CHECK_THROW_IMPL</code> should provide a <code>catch(...)</code> block and report relevant errors in place, rather than letting the exception escape. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12800 Trac 1.4.3 Raffi Enficiaud Thu, 02 Feb 2017 21:43:53 GMT <link>https://svn.boost.org/trac10/ticket/12800#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12800#comment:1</guid> <description> <p> The framework is not letting the exception escape, as it is being caught by the <code>BOOST_AUTO_TEST_CASE</code> itself. If you remove the <code>catch(...)</code> you will see it. </p> <p> We use exceptions to stop executions on <code>BOOST_TEST_REQUIRE</code> like assertion macros. This cannot work if there is a <code>catch(...)</code> after the macro. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Wed, 01 Mar 2017 23:28:59 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12800#comment:2 https://svn.boost.org/trac10/ticket/12800#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> Ticket