25 #ifndef WEXCEPTION_TEST_H
26 #define WEXCEPTION_TEST_H
31 #include <cxxtest/TestSuite.h>
33 #include "../WException.h"
47 TS_ASSERT_THROWS_NOTHING(
WException e( std::string(
"Some message" ) ) );
55 WException e( std::string(
"Dummy exception" ) );
57 e.
m_trace.push_back(
"second" );
58 std::string expected =
"Dummy exception\n\ntrace: first\ntrace: second";
59 TS_ASSERT_EQUALS( expected, e.
getTrace() );
61 TS_ASSERT_EQUALS( std::string(), f.
getTrace() );
69 #if( defined( __linux__ ) && defined( __GNUC__ ) )
79 TS_ASSERT( bt.length() );
void testInstantiation(void)
An instantiation should never throw an exception.
void testBacktrace(void)
Test backtrace.
void testGetMessage(void)
Getting the message means every trace element should be returned.
std::list< std::string > m_trace
Stack trace for identifying the source where this exception came from.
std::string getBacktrace() const
Returns a call stacktrace.
std::string getTrace() const
Prints the trace of the call chain which caused this exception.