diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index e28308d..bd2df4c 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -24,3 +24,6 @@ lib lib3_throw : lib3_throw.cpp : LIB3_SOURCE=1 shared:LIB run throw_from_library_test.cpp lib1_throw lib2_throw lib3_throw : : : static : throw_from_library_static ; run throw_from_library_test.cpp lib1_throw lib2_throw lib3_throw : : : shared : throw_from_library_shared ; + +run throw_exception_nx_test.cpp : : : off ; +run throw_exception_nx_test2.cpp : : : off ; diff --git a/test/throw_exception_nx_test.cpp b/test/throw_exception_nx_test.cpp new file mode 100644 index 0000000..86957f8 --- /dev/null +++ b/test/throw_exception_nx_test.cpp @@ -0,0 +1,24 @@ +// Copyright 2019 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +class my_exception: public std::exception {}; + +int main() +{ + boost::throw_exception( my_exception() ); + return 1; +} + +namespace boost +{ + +void throw_exception( std::exception const & ) +{ + std::exit( 0 ); +} + +} // namespace boost diff --git a/test/throw_exception_nx_test2.cpp b/test/throw_exception_nx_test2.cpp new file mode 100644 index 0000000..4964f77 --- /dev/null +++ b/test/throw_exception_nx_test2.cpp @@ -0,0 +1,30 @@ +// Copyright 2019 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include + +class my_exception: public std::exception {}; + +int main() +{ + BOOST_THROW_EXCEPTION( my_exception() ); + return 1; +} + +namespace boost +{ + +void throw_exception( std::exception const &, boost::source_location const & loc ) +{ + int r = 0; + + if( std::strcmp( loc.file_name(), __FILE__ ) != 0 ) ++r; + if( loc.line() != 13 ) ++r; + + std::exit( r ); +} + +} // namespace boost