forked from boostorg/core
Add no_exceptions_support_test
This commit is contained in:
@ -141,10 +141,13 @@ run test_lib_typeid.cpp lib_typeid : : : <link>shared : test_lib_typeid_shared ;
|
||||
run test_lib_typeid.cpp lib_typeid : : : <link>static : test_lib_typeid_static ;
|
||||
|
||||
run test_lib_typeid.cpp lib_typeid : : : <link>shared <rtti>off : test_lib_typeid_shared_no_rtti ;
|
||||
run test_lib_typeid.cpp lib_typeid : : : <link>static <rtti>off : test_lib_typeid_static_no_rtti ;
|
||||
run test_lib_typeid.cpp lib_typeid : : : <link>static <rtti>off : test_lib_typeid_static_no_rtti ;
|
||||
|
||||
run uncaught_exceptions.cpp : : : <exception-handling>on ;
|
||||
run uncaught_exceptions_np.cpp : : : <exception-handling>on ;
|
||||
|
||||
run no_exceptions_support_test.cpp ;
|
||||
run no_exceptions_support_test.cpp : : : <exception-handling>off : no_exceptions_support_test_nx ;
|
||||
|
||||
use-project /boost/core/swap : ./swap ;
|
||||
build-project ./swap ;
|
||||
|
52
test/no_exceptions_support_test.cpp
Normal file
52
test/no_exceptions_support_test.cpp
Normal file
@ -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 <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/core/quick_exit.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <exception>
|
||||
|
||||
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
|
Reference in New Issue
Block a user