From 6ff2e5dca53fc50bef54ef3eeaaed83d35cbc061 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 17 Jun 2024 21:52:29 +0300 Subject: [PATCH] Update throw_exception_test4.cpp --- test/throw_exception_test4.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/throw_exception_test4.cpp b/test/throw_exception_test4.cpp index 69be7d2..cc36c2f 100644 --- a/test/throw_exception_test4.cpp +++ b/test/throw_exception_test4.cpp @@ -24,8 +24,9 @@ class my_exception3: public std::exception, public virtual boost::exception char const* translate_function( char const * fn, char const * cfn ) { - // translate "" and "main" to BOOST_CURRENT_FUNCTION - return fn[0] == 0 || std::strcmp( fn, "main" ) == 0? cfn: fn; + // fn comes from BOOST_CURRENT_LOCATION, which is not necessarily the same as BOOST_CURRENT_FUNCTION + // so translate the known problematic cases to BOOST_CURRENT_FUNCTION to make the test pass + return fn[0] == 0 || std::strcmp( fn, "main" ) == 0 || std::strcmp( fn, "int __cdecl main(void)" ) == 0? cfn: fn; } static char const* adjust_filename( char const* file ) @@ -61,7 +62,7 @@ int main() int const * line = boost::get_error_info( x ); BOOST_TEST( line != 0 ); - BOOST_TEST_EQ( *line, 49 ); + BOOST_TEST_EQ( *line, 50 ); } { @@ -89,7 +90,7 @@ int main() int const * line = boost::get_error_info( x ); BOOST_TEST( line != 0 ); - BOOST_TEST_EQ( *line, 77 ); + BOOST_TEST_EQ( *line, 78 ); } { @@ -117,7 +118,7 @@ int main() int const * line = boost::get_error_info( x ); BOOST_TEST( line != 0 ); - BOOST_TEST_EQ( *line, 105 ); + BOOST_TEST_EQ( *line, 106 ); } {