summaryrefslogtreecommitdiff
path: root/include/cppunit
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2001-10-06 09:16:31 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2001-10-06 09:16:31 +0000
commit4c6c7e6474bef34c4bed0d3eb9889012319c938f (patch)
tree8c92755d5109834b78ea620a224fd2ef75abeb09 /include/cppunit
parentfbd454f554f13680fe62b36fb7a5829f6dc0c396 (diff)
downloadcppunit-4c6c7e6474bef34c4bed0d3eb9889012319c938f.tar.gz
Examples/cppunittest/CppUnitTestMain.
examples/cppunittest/CppUnitTestMain.cpp : application returns 0 is test suite run sucessfuly, 1 otherwise. * src/cppunit/Exception.cpp : bug fix, operator =() with VC++. Removed call to std::exception::operator =() which is bugged on VC++. * doc/FAQ : added a note explaining why the test ExceptionTest.testAssignment used to fail. * NEWS : updated and detailed. * include/cppunit/TestResult.h : * src/cppunit/TestResult.cpp : added reset(). * include/cppunit/TextTestRunner.h : * src/cppunit/TextTestRunner.cpp : Constructor take an optional TextTestRestult. The TextTestResult remain alive as long as the runner. Added result() to retreive the result. Printing the result is now optinal (enabled by default).
Diffstat (limited to 'include/cppunit')
-rw-r--r--include/cppunit/Exception.h3
-rw-r--r--include/cppunit/TestResult.h2
-rw-r--r--include/cppunit/TextTestRunner.h28
3 files changed, 21 insertions, 12 deletions
diff --git a/include/cppunit/Exception.h b/include/cppunit/Exception.h
index f94eca5..a051ce9 100644
--- a/include/cppunit/Exception.h
+++ b/include/cppunit/Exception.h
@@ -46,7 +46,8 @@ public:
Exception& operator= (const Exception& other);
- const char *what() const throw ();
+// const char *what() const throw ();
+ const char *what() const;
SourceLine sourceLine() const;
diff --git a/include/cppunit/TestResult.h b/include/cppunit/TestResult.h
index dfb3889..855be27 100644
--- a/include/cppunit/TestResult.h
+++ b/include/cppunit/TestResult.h
@@ -50,6 +50,8 @@ class TestResult
TestResult( SynchronizationObject *syncObject =0 );
virtual ~TestResult();
+ virtual void reset();
+
virtual void addError( Test *test, Exception *e );
virtual void addFailure( Test *test, Exception *e );
virtual void startTest( Test *test );
diff --git a/include/cppunit/TextTestRunner.h b/include/cppunit/TextTestRunner.h
index 5c5180d..e44f68d 100644
--- a/include/cppunit/TextTestRunner.h
+++ b/include/cppunit/TextTestRunner.h
@@ -8,6 +8,7 @@ namespace CppUnit {
class Test;
class TestSuite;
+class TextTestResult;
/**
* A text mode test runner.
@@ -30,21 +31,26 @@ class TestSuite;
class TextTestRunner
{
public:
- TextTestRunner();
- virtual ~TextTestRunner();
+ TextTestRunner( TextTestResult *result =0 );
+ virtual ~TextTestRunner();
- bool run( std::string testName ="",
- bool wait = false );
+ bool run( std::string testName ="",
+ bool wait = false,
+ bool printResult = true );
- void addTest( Test *test );
+ void addTest( Test *test );
-protected:
- bool runTest( Test *test );
- bool runTestByName( std::string testName );
- void wait( bool doWait );
+ TextTestResult *result();
- Test *findTestByName( std::string name ) const;
- TestSuite *m_suite;
+protected:
+ bool runTest( Test *test );
+ bool runTestByName( std::string testName );
+ void wait( bool doWait );
+ void printResult( bool doPrintResult );
+
+ Test *findTestByName( std::string name ) const;
+ TestSuite *m_suite;
+ TextTestResult *m_result;
};
} // namespace CppUnit