Hi,
I'm using the test library of boost 1.49.0 for my unit tests. It works fine so
fare, but if my program throws an error, I get the default error message
unknown location(0): fatal error in "excption1_test": unknown type,
witch hides the original error message.
I tried to register an error translator, but without success. Here is what I
tried (modified test/test/custom_exception_test.cpp to use auto test with
global fixture):
#define BOOST_TEST_MODULE "boost test custom_exception_test"
#include
#include
using namespace boost::unit_test;
BOOST_AUTO_TEST_SUITE( custom_exception_testsuite )
struct my_exception1 {
explicit my_exception1( int res_code ) : m_res_code( res_code ) {}
int m_res_code;
};
void throw_my_exception1() {
throw my_exception1( 12 );
}
void my_exception1_translator( my_exception1 ) {
BOOST_TEST_MESSAGE( "Caught my_exception1" );
}
class my_config {
public:
my_config () {
unit_test_monitor.register_exception_translator(
&my_exception1_translator );
}
};
BOOST_GLOBAL_FIXTURE( my_config )
BOOST_AUTO_TEST_CASE( excption1_test ) {
throw_my_exception1();
}
BOOST_AUTO_TEST_SUITE_END()
Can anybody tell me what I'm missing?
Thanks,
Jörg