diff options
Diffstat (limited to 'boost/test/detail/throw_exception.hpp')
-rw-r--r-- | boost/test/detail/throw_exception.hpp | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/boost/test/detail/throw_exception.hpp b/boost/test/detail/throw_exception.hpp index b29b9c07dd..2fee10c2cb 100644 --- a/boost/test/detail/throw_exception.hpp +++ b/boost/test/detail/throw_exception.hpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2015. +// (C) Copyright Gennadiy Rozental 2001. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -29,34 +29,37 @@ namespace boost { namespace unit_test { namespace ut_detail { -#ifdef BOOST_NO_EXCEPTION +#ifdef BOOST_NO_EXCEPTIONS template<typename E> -inline int -throw_exception(E const& e) { abort(); return 0; } +BOOST_NORETURN inline void +throw_exception(E const& e) { abort(); } -#define BOOST_TEST_IMPL_TRY -#define BOOST_TEST_IMPL_CATCH( T, var ) for(T const& var = *(T*)0; false;) -#define BOOST_TEST_IMPL_CATCH0( T ) if(0) -#define BOOST_TEST_IMPL_CATCHALL() if(0) -#define BOOST_TEST_IMPL_RETHROW +#define BOOST_TEST_I_TRY +#define BOOST_TEST_I_CATCH( T, var ) for(T const& var = *(T*)0; false;) +#define BOOST_TEST_I_CATCH0( T ) if(0) +#define BOOST_TEST_I_CATCHALL() if(0) +#define BOOST_TEST_I_RETHROW #else template<typename E> -inline int -throw_exception(E const& e) { throw e; return 0; } - -#define BOOST_TEST_IMPL_TRY try -#define BOOST_TEST_IMPL_CATCH( T, var ) catch( T const& var ) -#define BOOST_TEST_IMPL_CATCH0( T ) catch( T const& ) -#define BOOST_TEST_IMPL_CATCHALL() catch(...) -#define BOOST_TEST_IMPL_RETHROW throw +BOOST_NORETURN inline void +throw_exception(E const& e) { throw e; } + +#define BOOST_TEST_I_TRY try +#define BOOST_TEST_I_CATCH( T, var ) catch( T const& var ) +#define BOOST_TEST_I_CATCH0( T ) catch( T const& ) +#define BOOST_TEST_I_CATCHALL() catch(...) +#define BOOST_TEST_I_RETHROW throw #endif //____________________________________________________________________________// -#define BOOST_TEST_IMPL_THROW( E ) unit_test::ut_detail::throw_exception( E ) +#define BOOST_TEST_I_THROW( E ) unit_test::ut_detail::throw_exception( E ) +#define BOOST_TEST_I_THROW( E ) unit_test::ut_detail::throw_exception( E ) +#define BOOST_TEST_I_ASSRT( cond, ex ) if( cond ) {} else BOOST_TEST_I_THROW( ex ) + } // namespace ut_detail } // namespace unit_test |