forked from boostorg/throw_exception
Update throw_exception_test4.cpp
This commit is contained in:
@ -9,10 +9,6 @@
|
|||||||
#include <boost/exception/get_error_info.hpp>
|
#include <boost/exception/get_error_info.hpp>
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
|
|
||||||
class my_exception: public std::exception
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class my_exception2: public std::exception, public boost::exception
|
class my_exception2: public std::exception, public boost::exception
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
@ -23,38 +19,6 @@ class my_exception3: public std::exception, public virtual boost::exception
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
BOOST_THROW_EXCEPTION( my_exception() );
|
|
||||||
}
|
|
||||||
catch( boost::exception const & x )
|
|
||||||
{
|
|
||||||
{
|
|
||||||
char const * const * file = boost::get_error_info<boost::throw_file>( x );
|
|
||||||
|
|
||||||
BOOST_TEST( file != 0 );
|
|
||||||
BOOST_TEST_CSTR_EQ( *file, __FILE__ );
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
int const * line = boost::get_error_info<boost::throw_line>( x );
|
|
||||||
|
|
||||||
BOOST_TEST( line != 0 );
|
|
||||||
BOOST_TEST_EQ( *line, 28 );
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
char const * const * function = boost::get_error_info<boost::throw_function>( x );
|
|
||||||
|
|
||||||
BOOST_TEST( function != 0 );
|
|
||||||
BOOST_TEST_CSTR_EQ( *function, BOOST_CURRENT_FUNCTION );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch( ... )
|
|
||||||
{
|
|
||||||
BOOST_ERROR( "BOOST_THROW_EXCEPTION( my_exception() ) didn't throw boost::exception" );
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BOOST_THROW_EXCEPTION( my_exception2() );
|
BOOST_THROW_EXCEPTION( my_exception2() );
|
||||||
@ -72,7 +36,7 @@ int main()
|
|||||||
int const * line = boost::get_error_info<boost::throw_line>( x );
|
int const * line = boost::get_error_info<boost::throw_line>( x );
|
||||||
|
|
||||||
BOOST_TEST( line != 0 );
|
BOOST_TEST( line != 0 );
|
||||||
BOOST_TEST_EQ( *line, 60 );
|
BOOST_TEST_EQ( *line, 24 );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -104,7 +68,7 @@ int main()
|
|||||||
int const * line = boost::get_error_info<boost::throw_line>( x );
|
int const * line = boost::get_error_info<boost::throw_line>( x );
|
||||||
|
|
||||||
BOOST_TEST( line != 0 );
|
BOOST_TEST( line != 0 );
|
||||||
BOOST_TEST_EQ( *line, 92 );
|
BOOST_TEST_EQ( *line, 56 );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user