mirror of
https://github.com/boostorg/throw_exception.git
synced 2025-07-13 20:46:31 +02:00
Add boost::throw_exception overload taking a boost::source_location; use it in BOOST_THROW_EXCEPTION
This commit is contained in:
@ -25,10 +25,26 @@ int main()
|
||||
}
|
||||
catch( boost::exception const & x )
|
||||
{
|
||||
int const * line = boost::get_error_info<boost::throw_line>( x );
|
||||
{
|
||||
char const * const * file = boost::get_error_info<boost::throw_file>( x );
|
||||
|
||||
BOOST_TEST( line != 0 );
|
||||
BOOST_TEST_EQ( *line, 24 );
|
||||
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, 24 );
|
||||
}
|
||||
|
||||
{
|
||||
char const * const * function = boost::get_error_info<boost::throw_function>( x );
|
||||
|
||||
BOOST_TEST( function != 0 );
|
||||
BOOST_TEST_CSTR_EQ( *function, BOOST_CURRENT_FUNCTION );
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
@ -37,10 +53,26 @@ int main()
|
||||
}
|
||||
catch( boost::exception const & x )
|
||||
{
|
||||
int const * line = boost::get_error_info<boost::throw_line>( x );
|
||||
{
|
||||
char const * const * file = boost::get_error_info<boost::throw_file>( x );
|
||||
|
||||
BOOST_TEST( line != 0 );
|
||||
BOOST_TEST_EQ( *line, 36 );
|
||||
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, 52 );
|
||||
}
|
||||
|
||||
{
|
||||
char const * const * function = boost::get_error_info<boost::throw_function>( x );
|
||||
|
||||
BOOST_TEST( function != 0 );
|
||||
BOOST_TEST_CSTR_EQ( *function, BOOST_CURRENT_FUNCTION );
|
||||
}
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
|
Reference in New Issue
Block a user