From 0600b49827e4be83c616c85518bad6f3b2a8ff10 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 19 Apr 2019 17:32:05 +0300 Subject: [PATCH] Add no_exceptions_support_test --- test/Jamfile.v2 | 5 ++- test/no_exceptions_support_test.cpp | 52 +++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 test/no_exceptions_support_test.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 29a5b2d..27fdf0f 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -141,10 +141,13 @@ run test_lib_typeid.cpp lib_typeid : : : shared : test_lib_typeid_shared ; run test_lib_typeid.cpp lib_typeid : : : static : test_lib_typeid_static ; run test_lib_typeid.cpp lib_typeid : : : shared off : test_lib_typeid_shared_no_rtti ; -run test_lib_typeid.cpp lib_typeid : : : static off : test_lib_typeid_static_no_rtti ; +run test_lib_typeid.cpp lib_typeid : : : static off : test_lib_typeid_static_no_rtti ; run uncaught_exceptions.cpp : : : on ; run uncaught_exceptions_np.cpp : : : on ; +run no_exceptions_support_test.cpp ; +run no_exceptions_support_test.cpp : : : off : no_exceptions_support_test_nx ; + use-project /boost/core/swap : ./swap ; build-project ./swap ; diff --git a/test/no_exceptions_support_test.cpp b/test/no_exceptions_support_test.cpp new file mode 100644 index 0000000..64533fa --- /dev/null +++ b/test/no_exceptions_support_test.cpp @@ -0,0 +1,52 @@ +// +// Test for no_exceptions_support.hpp +// +// Copyright 2019 Peter Dimov +// +// 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 +// + +#include +#include +#include +#include + +void f() +{ + boost::throw_exception( std::exception() ); +} + +int main() +{ + BOOST_TRY + { + f(); + } + BOOST_CATCH( std::exception const& ) + { + return 0; + } + BOOST_CATCH( ... ) + { + return 1; + } + BOOST_CATCH_END + + return 1; +} + +#if defined(BOOST_NO_EXCEPTIONS) + +namespace boost +{ + +void throw_exception( std::exception const& ) +{ + boost::quick_exit( 0 ); +} + +} + +#endif