mirror of
https://github.com/boostorg/throw_exception.git
synced 2025-07-14 13:06:30 +02:00
Add test that catches by boost::exception
This commit is contained in:
@ -14,6 +14,8 @@ run throw_exception_no_both_test.cpp ;
|
|||||||
|
|
||||||
compile-fail throw_exception_fail.cpp ;
|
compile-fail throw_exception_fail.cpp ;
|
||||||
|
|
||||||
|
run throw_exception_test2.cpp ;
|
||||||
|
|
||||||
lib lib1_throw : lib1_throw.cpp : <define>LIB1_SOURCE=1 <link>shared:<define>LIB1_DYN_LINK=1 : : <link>shared:<define>LIB1_DYN_LINK=1 ;
|
lib lib1_throw : lib1_throw.cpp : <define>LIB1_SOURCE=1 <link>shared:<define>LIB1_DYN_LINK=1 : : <link>shared:<define>LIB1_DYN_LINK=1 ;
|
||||||
lib lib2_throw : lib2_throw.cpp : <define>LIB2_SOURCE=1 <link>shared:<define>LIB2_DYN_LINK=1 : : <link>shared:<define>LIB2_DYN_LINK=1 ;
|
lib lib2_throw : lib2_throw.cpp : <define>LIB2_SOURCE=1 <link>shared:<define>LIB2_DYN_LINK=1 : : <link>shared:<define>LIB2_DYN_LINK=1 ;
|
||||||
lib lib3_throw : lib3_throw.cpp : <define>LIB3_SOURCE=1 <link>shared:<define>LIB3_DYN_LINK=1 : : <link>shared:<define>LIB3_DYN_LINK=1 ;
|
lib lib3_throw : lib3_throw.cpp : <define>LIB3_SOURCE=1 <link>shared:<define>LIB3_DYN_LINK=1 : : <link>shared:<define>LIB3_DYN_LINK=1 ;
|
||||||
|
28
test/throw_exception_test2.cpp
Normal file
28
test/throw_exception_test2.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright 2018 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/throw_exception.hpp>
|
||||||
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
|
|
||||||
|
class my_exception: public std::exception
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class my_exception2: public std::exception, public boost::exception
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
BOOST_TEST_THROWS( boost::throw_exception( my_exception() ), boost::exception );
|
||||||
|
BOOST_TEST_THROWS( boost::throw_exception( my_exception2() ), boost::exception );
|
||||||
|
|
||||||
|
BOOST_TEST_THROWS( BOOST_THROW_EXCEPTION( my_exception() ), boost::exception );
|
||||||
|
BOOST_TEST_THROWS( BOOST_THROW_EXCEPTION( my_exception2() ), boost::exception );
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
Reference in New Issue
Block a user