summaryrefslogtreecommitdiff
path: root/src/cppunit/TestCase.cpp
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2001-06-11 18:59:15 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2001-06-11 18:59:15 +0000
commitc7a4dccd9f1b1fadcd47afe482c8a8ff9e05ea8f (patch)
treef0bb90d0fd555bbf07646380c6cab7bf06254620 /src/cppunit/TestCase.cpp
parent1806e9640462461fba3e1149c7b2c4a31805ec5e (diff)
downloadcppunit-c7a4dccd9f1b1fadcd47afe482c8a8ff9e05ea8f.tar.gz
Include/cppunit/NotEqualException.
include/cppunit/NotEqualException.cpp: addded, exception to be used with assertEquals(). * src/cppunit/RepeatedTest.cpp: added to reduce header dependency (TestResult.h was missing). * src/cppunit/TestAssert.cpp: added to put non template functions there. * src/cppunit/TestCase.cpp: added std:: prefix to catch (exception& e). Integrated a modified version of Tim Jansen patch (#403745) for TestCase to make the unit test (TestCaseTest) pass. If the setUp() fail then neither the runTest() nor the tearDown() method is called.
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);
}