summaryrefslogtreecommitdiff
path: root/src/cppunit/CompilerOutputter.cpp
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-06-13 14:31:01 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-06-13 14:31:01 +0000
commitabd178318ae3cdb6cc0a700e77414a33ef9297ca (patch)
tree76bb1f6d0bf28bfe23c710487d0b20bd95878ca4 /src/cppunit/CompilerOutputter.cpp
parent3702f4f7603f1e49b4d6747c49e795bad712eab7 (diff)
downloadcppunit-abd178318ae3cdb6cc0a700e77414a33ef9297ca.tar.gz
Include/cppunit/Asserter.
include/cppunit/Asserter.h: * src/cppunit/Asserter.cpp: added functions that take a Message as a parameter. Existing function have a short description indicating an assertion failure. * include/cppunit/CompilerOuputter.h: * src/cppunit/CompilerOuputter.cpp: removed printNotEqualMessage() and printDefaultMessage(). Updated to use Message. * include/cppunit/Message.h: * src/cppunit/Message.cpp: added. Represents a message associated to an Exception. * include/cppunit/Exception.h: * src/cppunit/Exception.cpp: the message associated to the exception is now stored as a Message instead of a string. * include/cppunit/NotEqualException.cpp: constructs a Message instead of a string. * include/cppunit/TestAssert.h: * src/cppunit/TestAssert.cpp: updated to use Asserter functions that take a message when pertinent (CPPUNIT_FAIL...). * include/cppunit/TestCaller.h: * src/cppunit/TestCaller.cpp: exception not caught failure has a better short description. * src/cppunit/TestCase.cpp: better short description when setUp() or tearDown() fail. * src/msvc6/testrunner/TestRunnerDlg.cpp: replace '\n' in failure message with space. * examples/cppunittest/ExceptionTest.cpp: * examples/cppunittest/NotEqualExceptionTest.cpp: * examples/cppunittest/TestCallerTest.cpp: * examples/cppunittest/TestFailureTest.cpp: * examples/cppunittest/TestResultCollectorTest.h: * examples/cppunittest/TestResultCollectorTest.cpp: * examples/cppunittest/TestResultTest.cpp: * examples/cppunittest/XmlOutputterTest.h: * examples/cppunittest/XmlOutputterTest.cpp: updated to use Exception/Message. * examples/cppunittest/MessageTest.h: * examples/cppunittest/MessageTest.cpp: added. Unit test for Message.
Diffstat (limited to 'src/cppunit/CompilerOutputter.cpp')
-rw-r--r--src/cppunit/CompilerOutputter.cpp31
1 files changed, 2 insertions, 29 deletions
diff --git a/src/cppunit/CompilerOutputter.cpp b/src/cppunit/CompilerOutputter.cpp
index 1c0b14f..2355fc9 100644
--- a/src/cppunit/CompilerOutputter.cpp
+++ b/src/cppunit/CompilerOutputter.cpp
@@ -169,35 +169,8 @@ CompilerOutputter::printFailureMessage( TestFailure *failure )
{
m_stream << std::endl;
Exception *thrownException = failure->thrownException();
- if ( thrownException->isInstanceOf( NotEqualException::type() ) )
- printNotEqualMessage( thrownException );
- else
- printDefaultMessage( thrownException );
- m_stream << std::endl;
-}
-
-
-void
-CompilerOutputter::printNotEqualMessage( Exception *thrownException )
-{
- NotEqualException *e = (NotEqualException *)thrownException;
- m_stream << wrap( "- Expected : " + e->expectedValue() );
- m_stream << std::endl;
- m_stream << wrap( "- Actual : " + e->actualValue() );
- m_stream << std::endl;
- if ( !e->additionalMessage().empty() )
- {
- m_stream << wrap( e->additionalMessage() );
- m_stream << std::endl;
- }
-}
-
-
-void
-CompilerOutputter::printDefaultMessage( Exception *thrownException )
-{
- std::string wrappedMessage = wrap( thrownException->what() );
- m_stream << wrappedMessage << std::endl;
+ m_stream << thrownException->message().shortDescription() << std::endl;
+ m_stream << wrap( thrownException->message().details() ) << std::endl;
}