forked from boostorg/function
Add throw/catch test for bad_function_call
This commit is contained in:
committed by
James E. King III
parent
755d3c2001
commit
5b2acbc175
@ -36,3 +36,8 @@ run nothrow_swap.cpp ;
|
|||||||
run rvalues_test.cpp ;
|
run rvalues_test.cpp ;
|
||||||
compile function_typeof_test.cpp ;
|
compile function_typeof_test.cpp ;
|
||||||
run result_arg_types_test.cpp ;
|
run result_arg_types_test.cpp ;
|
||||||
|
|
||||||
|
lib throw_bad_function_call : throw_bad_function_call.cpp : <link>shared:<define>THROW_BAD_FUNCTION_CALL_DYN_LINK=1 ;
|
||||||
|
|
||||||
|
run test_bad_function_call.cpp throw_bad_function_call : : : <link>shared : test_bad_function_call_shared ;
|
||||||
|
run test_bad_function_call.cpp throw_bad_function_call : : : <link>static : test_bad_function_call_static ;
|
||||||
|
14
test/test_bad_function_call.cpp
Normal file
14
test/test_bad_function_call.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
// Copyright 2018 Peter Dimov.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
void throw_bad_function_call();
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
BOOST_TEST_THROWS( throw_bad_function_call(), boost::bad_function_call );
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
17
test/throw_bad_function_call.cpp
Normal file
17
test/throw_bad_function_call.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
// Copyright 2018 Peter Dimov.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(THROW_BAD_FUNCTION_CALL_DYN_LINK)
|
||||||
|
# define EXPORT BOOST_SYMBOL_EXPORT
|
||||||
|
#else
|
||||||
|
# define EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EXPORT void throw_bad_function_call()
|
||||||
|
{
|
||||||
|
throw boost::bad_function_call();
|
||||||
|
}
|
Reference in New Issue
Block a user