diff options
| author | Steve M. Robbins <smr@sumost.ca> | 2001-07-15 03:18:06 +0000 |
|---|---|---|
| committer | Steve M. Robbins <smr@sumost.ca> | 2001-07-15 03:18:06 +0000 |
| commit | 08b4a5c444044db09dc5c668390e9f40663210ff (patch) | |
| tree | f94c3f33864a238e3edc29c6fc92ebff748e82fa /src/cppunit/TestCase.cpp | |
| parent | 8cdfc19f2213bf1de4aee4bc5e799af49b6608d0 (diff) | |
| download | cppunit-08b4a5c444044db09dc5c668390e9f40663210ff.tar.gz | |
Added documentation.
Diffstat (limited to 'src/cppunit/TestCase.cpp')
| -rw-r--r-- | src/cppunit/TestCase.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/cppunit/TestCase.cpp b/src/cppunit/TestCase.cpp index 91ad597..eb39a9f 100644 --- a/src/cppunit/TestCase.cpp +++ b/src/cppunit/TestCase.cpp @@ -7,50 +7,50 @@ #include "cppunit/Exception.h" #include "cppunit/TestResult.h" + namespace CppUnit { /// Create a default TestResult CppUnit::TestResult* TestCase::defaultResult () { return new TestResult; } + /// Run the test and catch any exceptions that are triggered by it void TestCase::run (TestResult *result) { - result->startTest (this); - - 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); - } + result->startTest (this); try { - tearDown (); + 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 ( ... ) { - result->addError( this, new Exception( "tearDown() failed" ) ); + result->addError( this, new Exception( "setUp() failed" ) ); } - } - catch ( ... ) { - result->addError( this, new Exception( "setUp() failed" ) ); - } - - result->endTest (this); - + + result->endTest (this); } |
