From 08b4a5c444044db09dc5c668390e9f40663210ff Mon Sep 17 00:00:00 2001 From: "Steve M. Robbins" Date: Sun, 15 Jul 2001 03:18:06 +0000 Subject: Added documentation. --- src/cppunit/TestCase.cpp | 58 ++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'src/cppunit/TestCase.cpp') 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); } -- cgit v1.2.1