diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2001-06-11 18:59:15 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2001-06-11 18:59:15 +0000 |
| commit | c7a4dccd9f1b1fadcd47afe482c8a8ff9e05ea8f (patch) | |
| tree | f0bb90d0fd555bbf07646380c6cab7bf06254620 /src/cppunit/Exception.cpp | |
| parent | 1806e9640462461fba3e1149c7b2c4a31805ec5e (diff) | |
| download | cppunit-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/Exception.cpp')
| -rw-r--r-- | src/cppunit/Exception.cpp | 79 |
1 files changed, 60 insertions, 19 deletions
diff --git a/src/cppunit/Exception.cpp b/src/cppunit/Exception.cpp index fa21f51..26a805e 100644 --- a/src/cppunit/Exception.cpp +++ b/src/cppunit/Exception.cpp @@ -1,37 +1,47 @@ #include "cppunit/Exception.h" -const std::string -CppUnit::Exception::UNKNOWNFILENAME = - "<unknown>"; -const int CppUnit::Exception::UNKNOWNLINENUMBER = -1; + +namespace CppUnit { + + +const std::string Exception::UNKNOWNFILENAME = "<unknown>"; + +const long Exception::UNKNOWNLINENUMBER = -1; + /// Construct the exception -CppUnit::Exception::Exception (const Exception& other) - : exception (other) +Exception::Exception (const Exception& other) : exception (other) { m_message = other.m_message; m_lineNumber = other.m_lineNumber; m_fileName = other.m_fileName; } -CppUnit::Exception::Exception (std::string message, long lineNumber, std::string fileName) - : m_message (message), m_lineNumber (lineNumber), m_fileName (fileName) + +Exception::Exception( std::string message, + long lineNumber, + std::string fileName ) : + m_message( message ), + m_lineNumber( lineNumber ), + m_fileName( fileName ) { } /// Destruct the exception -CppUnit::Exception::~Exception () -{} +Exception::~Exception () +{ +} /// Perform an assignment -CppUnit::Exception& -CppUnit::Exception::operator= (const Exception& other) +Exception& +Exception::operator=( const Exception& other ) { exception::operator= (other); - if (&other != this) { + if (&other != this) + { m_message = other.m_message; m_lineNumber = other.m_lineNumber; m_fileName = other.m_fileName; @@ -43,16 +53,47 @@ CppUnit::Exception::operator= (const Exception& other) /// Return descriptive message const char* -CppUnit::Exception::what() const throw () -{ return m_message.c_str (); } +Exception::what() const throw () +{ + return m_message.c_str (); +} + /// The line on which the error occurred long -CppUnit::Exception::lineNumber () -{ return m_lineNumber; } +Exception::lineNumber() +{ + return m_lineNumber; +} /// The file in which the error occurred std::string -CppUnit::Exception::fileName () -{ return m_fileName; } +Exception::fileName() +{ + return m_fileName; +} + + +Exception * +Exception::clone() const +{ + return new Exception( *this ); +} + + +bool +Exception::isInstanceOf( const Type &exceptionType ) const +{ + return exceptionType == type(); +} + + +Exception::Type +Exception::type() +{ + return Type( "CppUnit::Exception" ); +} + + +} // namespace CppUnit
\ No newline at end of file |
