summaryrefslogtreecommitdiff
path: root/src/cppunit/TextTestResult.cpp
diff options
context:
space:
mode:
authorSteve M. Robbins <smr@sumost.ca>2001-07-07 18:12:41 +0000
committerSteve M. Robbins <smr@sumost.ca>2001-07-07 18:12:41 +0000
commit936762c3876279c3973e30fea5919b719eae5a3f (patch)
tree0f4ac9bacb9329b8411438d17d58012b5c6ad1e9 /src/cppunit/TextTestResult.cpp
parentb73b5ccc56b78cd3a47da81b8a78f9d5d03403b5 (diff)
downloadcppunit-936762c3876279c3973e30fea5919b719eae5a3f.tar.gz
Removed last uses of estring.
Diffstat (limited to 'src/cppunit/TextTestResult.cpp')
-rw-r--r--src/cppunit/TextTestResult.cpp117
1 files changed, 59 insertions, 58 deletions
diff --git a/src/cppunit/TextTestResult.cpp b/src/cppunit/TextTestResult.cpp
index 115da91..0ef25e6 100644
--- a/src/cppunit/TextTestResult.cpp
+++ b/src/cppunit/TextTestResult.cpp
@@ -3,7 +3,6 @@
#include "cppunit/Exception.h"
#include "cppunit/NotEqualException.h"
#include "cppunit/Test.h"
-#include "estring.h"
namespace CppUnit {
@@ -38,70 +37,72 @@ TextTestResult::startTest (Test *test)
void
TextTestResult::printErrors (std::ostream& stream)
{
- if (testErrors () != 0) {
-
- if (testErrors () == 1)
- stream << "There was " << testErrors () << " error: " << std::endl;
- else
- stream << "There were " << testErrors () << " errors: " << std::endl;
-
- int i = 1;
-
- for (std::vector<TestFailure *>::iterator it = errors ().begin (); it != errors ().end (); ++it) {
- TestFailure *failure = *it;
- Exception *e = failure->thrownException ();
-
- stream << i
- << ") "
- << "test: " << failure->failedTest()->getName() << " "
- << "line: " << (e ? estring (e->lineNumber ()) : "") << " "
- << (e ? e->fileName () : "") << " "
- << "\"" << failure->thrownException ()->what () << "\""
- << std::endl;
- i++;
- }
- }
+ if ( testErrors() == 0 )
+ return;
+ if (testErrors () == 1)
+ stream << "There was 1 error: " << std::endl;
+ else
+ stream << "There were " << testErrors () << " errors: " << std::endl;
+
+ int i = 1;
+
+ for (std::vector<TestFailure *>::iterator it = errors ().begin (); it != errors ().end (); ++it) {
+ TestFailure* failure = *it;
+ Exception* e = failure->thrownException ();
+
+ stream << i
+ << ")"
+ << " test: " << failure->failedTest()->getName();
+ if ( e )
+ stream << " line: " << e->lineNumber()
+ << ' ' << e->fileName();
+ stream << " \"" << failure->thrownException()->what() << "\""
+ << std::endl;
+ i++;
+ }
}
+
void
TextTestResult::printFailures (std::ostream& stream)
{
- if (testFailures () != 0) {
- if (testFailures () == 1)
- stream << "There was " << testFailures () << " failure: " << std::endl;
- else
- stream << "There were " << testFailures () << " failures: " << std::endl;
-
- int i = 1;
-
- for (std::vector<TestFailure *>::iterator it = failures ().begin (); it != failures ().end (); ++it) {
- TestFailure *failure = *it;
- Exception *e = failure->thrownException ();
-
- stream << i
- << ") "
- << "test: " << failure->failedTest()->getName() << " "
- << "line: " << (e ? estring (e->lineNumber ()) : "") << " "
- << (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++;
- }
- }
+ if ( testFailures() == 0 )
+ return;
+ if (testFailures () == 1)
+ stream << "There was 1 failure: " << std::endl;
+ else
+ stream << "There were " << testFailures () << " failures: " << std::endl;
+
+ int i = 1;
+
+ for (std::vector<TestFailure *>::iterator it = failures ().begin (); it != failures ().end (); ++it) {
+ TestFailure* failure = *it;
+ Exception* e = failure->thrownException();
+
+ stream << i
+ << ")"
+ << " test: " << failure->failedTest()->getName();
+ if ( e )
+ stream << " line: " << e->lineNumber()
+ << ' ' << 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++;
+ }
}