|  | Home | Libraries | People | FAQ | More | 
BOOST_WARN_NO_THROW(expression); BOOST_CHECK_NO_THROW(expression); BOOST_REQUIRE_NO_THROW(expression);
          These assertions validate that the execution of expression
          does not throw any exception. To that extent, all possible exception are
          caught by assertion itself and no exception is propagated to the test body.
        
| ![[Tip]](../../../../../../../doc/src/images/tip.png) | Tip | 
|---|---|
| 
            It is possible to test for complex expressions with the use of constructs
            such as  | 
| Code | 
|---|
| #define BOOST_TEST_MODULE example #include <boost/test/included/unit_test.hpp> class my_exception{}; void some_func( int i ) { if( i<0 ) throw my_exception(); } BOOST_AUTO_TEST_CASE( test ) { BOOST_CHECK_NO_THROW( some_func(-1) ); BOOST_CHECK_NO_THROW( do { int i(-2); some_func(i); } while(0) ); } | 
| Output | 
|---|
| > example Running 1 test case... ../doc/examples/exception_nothrow.run-fail.cpp:18: error: in "test": exception thrown by some_func(-1) ../doc/examples/exception_nothrow.run-fail.cpp:24: error: in "test": exception thrown by do { int i(-2); some_func(i); } while(0) *** 2 failures are detected in the test module "example" | 
See also: