Update of /cvsroot/mockpp/mockpp/mockpp/chaining
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7837/mockpp/chaining
Modified Files:
AbstractDynamicChainingMock.h InvocationMocker.h
Log Message:
optionally disable exceptions
Index: InvocationMocker.h
===================================================================
RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/InvocationMocker.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- InvocationMocker.h 26 Nov 2005 17:56:30 -0000 1.36
+++ InvocationMocker.h 27 Nov 2005 17:27:57 -0000 1.37
@@ -121,17 +121,19 @@
*/
virtual void verify()
{
- try
+ MOCKPP_TRY
{
for ( ConstIterator it = matchers.begin(); it != matchers.end(); ++it )
( *it ) ->verify();
}
+#ifndef MOCKPP_NO_EXCEPTIONS
catch ( const AssertionFailedError & error )
{
assertionFailed( __LINE__, __FILE__,
error.getMessage() + MOCKPP_PCHAR( "\n" ) + this->toString() );
}
+#endif // MOCKPP_NO_EXCEPTIONS
}
/** Sets the object's name
Index: AbstractDynamicChainingMock.h
===================================================================
RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/AbstractDynamicChainingMock.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- AbstractDynamicChainingMock.h 26 Nov 2005 17:56:30 -0000 1.36
+++ AbstractDynamicChainingMock.h 27 Nov 2005 17:27:57 -0000 1.37
@@ -133,11 +133,12 @@
{
forgetFailure();
- try
+ MOCKPP_TRY
{
invocationDispatcher->verify();
}
+#ifndef MOCKPP_NO_EXCEPTIONS
catch ( const AssertionFailedError &ex )
{
assertionFailed( __LINE__, __FILE__,
@@ -146,6 +147,7 @@
+ MOCKPP_PCHAR( ": " )
+ ex.getMessage() );
}
+#endif // MOCKPP_NO_EXCEPTIONS
}
/** Transform the object's state to a human readable string.
@@ -254,11 +256,12 @@
this->failure->getSrcFile(),
this->failure->getMessage());
- try
+ MOCKPP_TRY
{
return this->invocationDispatcher->dispatch( invocation );
}
+#ifndef MOCKPP_NO_EXCEPTIONS
catch ( const AssertionFailedError & assertion )
{
DynamicChainingMockError<R, I> dme( this,
@@ -271,6 +274,7 @@
this->failure->getMessage());
}
return R();
+#endif // MOCKPP_NO_EXCEPTIONS
}
};
@@ -314,13 +318,14 @@
virtual void mockInvocation( const I &invocation )
{
if ( this->failure.get() != 0 )
- throw *this->failure.get();
+ MOCKPP_THROW(*this->failure.get());
- try
+ MOCKPP_TRY
{
this->invocationDispatcher->dispatch( invocation );
}
+#ifndef MOCKPP_NO_EXCEPTIONS
catch ( const AssertionFailedError & assertion )
{
DynamicChainingMockError<void, I> dme( this,
@@ -328,8 +333,9 @@
this->invocationDispatcher.get(),
assertion.getMessage() );
this->failure.reset( new AssertionFailedError(__LINE__, __FILE__, dme.getMessage()));
- throw *this->failure.get();
+ MOCKPP_THROW(*this->failure.get());
}
+#endif // MOCKPP_NO_EXCEPTIONS
}
};
@@ -374,7 +380,7 @@
void mockInvocation( const I &invocation ) \
{ \
if ( this->failure.get() != 0 ) \
- throw *this->failure.get(); \
+ MOCKPP_THROW(*this->failure.get()); \
\
try \
{ \
@@ -388,7 +394,7 @@
this->invocationDispatcher.get(), \
assertion.getMessage() ); \
this->failure.reset( new AssertionFailedError(__LINE__, __FILE__, dme.getMessage())); \
- throw *this->failure.get(); \
+ MOCKPP_THROW(*this->failure.get()); \
} \
} \
}; \
|