[boost.test] How to register custom exception for auto test?

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

Jörg Becker
I tried to register an error translator, but without success.
I've tried your example word for word and it appears to work as expected? What do you observe? Gennadiy

On Tuesday 06 November 2012 16:36:50 Gennadiy Rozenal wrote:
I've tried your example word for word and it appears to work as expected? What do you observe?
I expect to see: Caught my_exception1 I get: Running 1 test case... unknown location(0): fatal error in "excption1_test": unknown type Environment: boost 1.49.0 gcc 4.6.3 Fedora 15 linked boost test library Jörg

Jörg Becker
I expect to see: Caught my_exception1
This is what I observe with trunk build.
I get: Running 1 test case... unknown location(0): fatal error in "excption1_test": unknown type
Environment: boost 1.49.0 gcc 4.6.3 Fedora 15 linked boost test library
Weird. Should have worked. Gennadiy

On Thursday 08 November 2012 22:19:09 Gennadiy Rozental wrote:
Jörg Becker
writes: I expect to see: Caught my_exception1
This is what I observe with trunk build.
I get: Running 1 test case... unknown location(0): fatal error in "excption1_test": unknown type
Environment: boost 1.49.0 gcc 4.6.3 Fedora 15 linked boost test library
Weird. Should have worked.
Gennadiy
Hello again!
I just gave boost 1.55.0 with gcc 4.7.2 a try. But the old test in my initial
mail still results in unknown location(0): fatal error in "excption1_test":
unknown type.
Since I was sure I saw the custom exception handling working one day, I tried
the header only version by including
#include

Jörg Becker
Hello again!
I just gave boost 1.55.0 with gcc 4.7.2 a try. But the old test in my initial mail still results in unknown location(0): fatal error in "exception1_test": unknown type.
Since I was sure I saw the custom exception handling working one day, I tried the header only version by including #include
. And this time I saw the expected result: Caught my_exception1!!! Unfortunately I have to use the dynamic library test variant. So can anybody tell me how to enable the custom exception handling for the dynamic test library? What is the difference to the header-only variant (concerning the exception handling).
Hi Jörg, I think the only significant difference is that library is build using different build command. Maybe somehow it disables exceptions or something. Otherwise I do not see a reason for this to happend. Let me know if you ever figured out what was the root cause. Regards, Gennadiy
participants (3)
-
Gennadiy Rozenal
-
Gennadiy Rozental
-
Jörg Becker