This sound like a compilation related issue rather than a CppUnit issue (CppUnit just wrap the test with some try/catch).
A common issue is attempting to use a library compiled in debug mode in release mode on windows (stack structure are not compatible and attempting to raise an exception that cross debug/release stack cause a crash).
Also, you may not have enabled exception in your executable.
Baptiste.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm just starting up with CppUnit and I'm having this same problem when using exceptions with the sample code at The Cookbook.
I'm using MSVC7 with exceptions enabled (default). It actually turns out that disabling exceptions produces the same result (could this be a symptom of improper workspace setup?).
Also, when modifying the "testDivideByZeroThrows" to use try/catch blocks, the exception isn't locally caught. It is caught by the DefaultProtector::protect(..) method, as in the first case.
Is there a way to use my own exception handling?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Any ideas on how I could test a class that includes exceptions?
Whenever I try to test a specific function that includes the try and catch blocks I get this error and all the other tests don't execute.
I've tried using the CPPUNIT_ASSERT_NO_THROW macro or CPP_FAIL in case of a catch but to no success.
This sound like a compilation related issue rather than a CppUnit issue (CppUnit just wrap the test with some try/catch).
A common issue is attempting to use a library compiled in debug mode in release mode on windows (stack structure are not compatible and attempting to raise an exception that cross debug/release stack cause a crash).
Also, you may not have enabled exception in your executable.
Baptiste.
Hi,
I'm just starting up with CppUnit and I'm having this same problem when using exceptions with the sample code at The Cookbook.
I'm using MSVC7 with exceptions enabled (default). It actually turns out that disabling exceptions produces the same result (could this be a symptom of improper workspace setup?).
Also, when modifying the "testDivideByZeroThrows" to use try/catch blocks, the exception isn't locally caught. It is caught by the DefaultProtector::protect(..) method, as in the first case.
Is there a way to use my own exception handling?