summaryrefslogtreecommitdiff
path: root/src/cppunit/TextTestResult.cpp
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2001-06-12 05:59:26 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2001-06-12 05:59:26 +0000
commitbf78ed5d2c0f623efd08c277f97b240f2fef7ee6 (patch)
tree6faa8ef2ae7d679cb14111211e8971f2deb9a54f /src/cppunit/TextTestResult.cpp
parent517df147c8508ec32c7ab780cc434d7f541e2bc7 (diff)
downloadcppunit-bf78ed5d2c0f623efd08c277f97b240f2fef7ee6.tar.gz
Include/cppunit/NotEqualException.
include/cppunit/NotEqualException.h * src/cppunit/NotEqualException.h: Fixed constructor and operator = (aren't unit test nice?). Added methods expectedValue() and actualValue(). * include/cppunit/TestAssert.h: * src/cppunit/TestAssert.cpp: Use NotEqualException to report equality failure. * src/cppunit/TestResult.cpp: Report expect/was on different line for assertEquals failure. * examples/cppunittest/NotEqualExceptionTest.*: added unit tests for NotEqualException.
Diffstat (limited to 'src/cppunit/TextTestResult.cpp')
-rw-r--r--src/cppunit/TextTestResult.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/cppunit/TextTestResult.cpp b/src/cppunit/TextTestResult.cpp
index cbd226f..115da91 100644
--- a/src/cppunit/TextTestResult.cpp
+++ b/src/cppunit/TextTestResult.cpp
@@ -1,6 +1,7 @@
#include <iostream>
#include "cppunit/TextTestResult.h"
#include "cppunit/Exception.h"
+#include "cppunit/NotEqualException.h"
#include "cppunit/Test.h"
#include "estring.h"
@@ -82,9 +83,21 @@ TextTestResult::printFailures (std::ostream& stream)
<< ") "
<< "test: " << failure->failedTest()->getName() << " "
<< "line: " << (e ? estring (e->lineNumber ()) : "") << " "
- << (e ? e->fileName () : "") << " "
- << "\"" << failure->thrownException ()->what () << "\""
- << std::endl;
+ << (e ? e->fileName () : "") << " ";
+
+ if ( failure->thrownException()->isInstanceOf( NotEqualException::type() ) )
+ {
+ NotEqualException *e = (NotEqualException*)failure->thrownException();
+ stream << std::endl
+ << "expected: " << e->expectedValue() << std::endl
+ << "but was: " << e->actualValue();
+ }
+ else
+ {
+ stream << "\"" << failure->thrownException ()->what () << "\"";
+ }
+
+ stream << std::endl;
i++;
}
}