summaryrefslogtreecommitdiff
path: root/src/cppunit/TestCase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cppunit/TestCase.cpp')
-rw-r--r--src/cppunit/TestCase.cpp48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/cppunit/TestCase.cpp b/src/cppunit/TestCase.cpp
index 66a2462..df5f96e 100644
--- a/src/cppunit/TestCase.cpp
+++ b/src/cppunit/TestCase.cpp
@@ -19,31 +19,37 @@ void
TestCase::run (TestResult *result)
{
result->startTest (this);
-
- setUp ();
-
- try {
- runTest ();
-
- }
- catch (Exception& e) {
- Exception *copy = new Exception (e);
- result->addFailure (this, copy);
-
- }
- catch (exception& e) {
- result->addError (this, new Exception (e.what ()));
-
+ try
+ {
+ setUp ();
+
+ try {
+ runTest ();
+ }
+ catch (Exception& e) {
+ Exception *copy = e.clone();
+ result->addFailure (this, copy);
+ }
+ catch (std::exception& e) {
+ result->addError (this, new Exception (e.what ()));
+ }
+ catch (...) {
+ Exception *e = new Exception ("caught unknown exception");
+ result->addError (this, e);
+ }
+
+ try {
+ tearDown ();
+ }
+ catch ( ... ) {
+ result->addError( this, new Exception( "tearDown() failed" ) );
+ }
}
- catch (...) {
- Exception *e = new Exception ("unknown exception");
- result->addError (this, e);
-
+ catch ( ... ) {
+ result->addError( this, new Exception( "setUp() failed" ) );
}
- tearDown ();
-
result->endTest (this);
}