Thread: [Mockpp-commits] mockpp/mockpp/tests AbstractDynamicChainingMock_test.cpp,1.32,1.33 AbstractInvocati
Brought to you by:
ewald-arnold
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7837/mockpp/tests Modified Files: AbstractDynamicChainingMock_test.cpp AbstractInvocationDispatcher_test.cpp ChainableMockMethod_1_test.cpp ChainableMockMethod_2_test.cpp ChainableMockMethod_test.cpp ChainableMockObject_1_test.cpp ChainableMockObject_1_void_test.cpp ChainableMockObject_2_test.cpp ChainableMockObject_2_void_test.cpp ChainableMockObject_3_test.cpp ChainableMockObject_3_void_test.cpp ChainableMockObject_4_test.cpp ChainableMockObject_4_void_test.cpp ChainableMockObject_5_test.cpp ChainableMockObject_5_void_test.cpp ChainableMockObject_test.cpp ChainableMockObject_void_test.cpp ChainingMockBuilder_test.cpp InvokeAtLeastMatcher_test.cpp InvokeAtLeastOnceMatcher_test.cpp InvokeAtMostMatcher_test.cpp InvokeCountMatcher_test.cpp InvokeOnceMatcher_test.cpp InvokedAfterMatcher_test.cpp InvokedBeforeMatcher_test.cpp InvokedRecorder_test.cpp StubSequence_test.cpp TestFailureMatcher_test.cpp TestFailureStub_test.cpp ThrowStub_test.cpp TypelessStubSequence_test.cpp VerifyingTestCaller_test.cpp compilecheck.cpp mockpp_pti_test.cpp Log Message: optionally disable exceptions Index: ChainableMockObject_5_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_5_void_test.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- ChainableMockObject_5_void_test.cpp 15 Oct 2005 15:40:58 -0000 1.13 +++ ChainableMockObject_5_void_test.cpp 27 Nov 2005 17:27:57 -0000 1.14 @@ -305,35 +305,41 @@ mockpp::eq( (unsigned int) 21)) .will(mockpp::throwException<void, int>(54321)); - try + MOCKPP_TRY { mcm.chainable_i(12, 23, 34, 45, 56); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(int i) { MOCKPP_ASSERT_TRUE(i == 12345); } +#endif - try + MOCKPP_TRY { mcm.chainable_i(65, 54, 43, 32, 21); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(int i) { MOCKPP_ASSERT_TRUE(i == 54321); } +#endif - try + MOCKPP_TRY { mcm.chainable_i(1, 2, 3, 4, 5); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: ChainableMockObject_4_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_4_test.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ChainableMockObject_4_test.cpp 26 Nov 2005 17:57:48 -0000 1.10 +++ ChainableMockObject_4_test.cpp 27 Nov 2005 17:27:57 -0000 1.11 @@ -123,15 +123,17 @@ MOCKPP_ASSERT_TRUE(mcm.chainable(12, 34, 56, 78) == 12345678); MOCKPP_ASSERT_TRUE(mcm.chainable(87, 65, 43, 21) == 87654321); - try + MOCKPP_TRY { mcm.chainable(1, 2, 3, 4); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: TestFailureMatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/TestFailureMatcher_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- TestFailureMatcher_test.cpp 15 Oct 2005 15:40:59 -0000 1.8 +++ TestFailureMatcher_test.cpp 27 Nov 2005 17:27:57 -0000 1.9 @@ -63,12 +63,13 @@ { mockpp::TestFailureMatcher tfm (MOCKPP_PCHAR("knorxi")); - try + MOCKPP_TRY { tfm.incInvoked(); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("knorxi")) @@ -79,6 +80,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif mockpp::String s = MOCKPP_PCHAR("hallo"); MOCKPP_ASSERT_TRUE(tfm.describeTo(s) == MOCKPP_PCHAR("halloknorxi")); Index: InvokedRecorder_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/InvokedRecorder_test.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- InvokedRecorder_test.cpp 15 Oct 2005 15:40:58 -0000 1.9 +++ InvokedRecorder_test.cpp 27 Nov 2005 17:27:57 -0000 1.10 @@ -62,12 +62,13 @@ { mockpp::InvokedRecorder ir; - try + MOCKPP_TRY { ir.verifyHasBeenInvoked(); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("was not invoked")) @@ -78,6 +79,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif MOCKPP_ASSERT_TRUE(ir.hasBeenInvoked() == false); MOCKPP_ASSERT_TRUE(ir.getInvocationCount() == 0); @@ -98,12 +100,13 @@ ir.verifyHasBeenInvoked(); ir.verifyHasBeenInvokedExactly(1); - try + MOCKPP_TRY { ir.verifyHasBeenInvokedExactly(2); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("number of times:")) @@ -114,6 +117,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif } Index: mockpp_pti_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/mockpp_pti_test.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- mockpp_pti_test.cpp 15 Oct 2005 15:40:59 -0000 1.7 +++ mockpp_pti_test.cpp 27 Nov 2005 17:27:57 -0000 1.8 @@ -47,6 +47,8 @@ #include <cppunit/extensions/HelperMacros.h> +#ifndef MOCKPP_NO_EXCEPTIONS + typedef mockpp::Invocation1<int> Setter1Invocation; #if 1 @@ -389,8 +391,9 @@ MOCKPP_ASSERT_TRUE(stub->invoked == true); } - } // ns +#endif // MOCKPP_NO_EXCEPTIONS + #endif // HAVE_CPPUNIT Index: InvokedBeforeMatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/InvokedBeforeMatcher_test.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- InvokedBeforeMatcher_test.cpp 15 Oct 2005 15:40:58 -0000 1.5 +++ InvokedBeforeMatcher_test.cpp 27 Nov 2005 17:27:57 -0000 1.6 @@ -80,12 +80,13 @@ MOCKPP_ASSERT_TRUE(iam.describeTo(s) == (MOCKPP_PCHAR("hallobefore beforematch (invoked)"))); MOCKPP_ASSERT_TRUE(s == (MOCKPP_PCHAR("hallobefore beforematch (invoked)"))); - try + MOCKPP_TRY { iam.incInvoked(1); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("called out of order")) @@ -96,6 +97,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif } Index: InvokeAtMostMatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/InvokeAtMostMatcher_test.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- InvokeAtMostMatcher_test.cpp 15 Oct 2005 15:40:58 -0000 1.7 +++ InvokeAtMostMatcher_test.cpp 27 Nov 2005 17:27:57 -0000 1.8 @@ -82,12 +82,13 @@ ir.incInvoked(); MOCKPP_ASSERT_TRUE(ir.matches() == false); - try + MOCKPP_TRY { ir.verify(); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("too often")) @@ -98,6 +99,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif s = MOCKPP_PCHAR("hallo"); MOCKPP_ASSERT_TRUE(ir.describeTo(s).find(MOCKPP_PCHAR("at most")) != mockpp::String::npos); Index: ChainableMockObject_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_void_test.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ChainableMockObject_void_test.cpp 13 Nov 2005 11:53:18 -0000 1.11 +++ ChainableMockObject_void_test.cpp 27 Nov 2005 17:27:57 -0000 1.12 @@ -105,16 +105,17 @@ MOCKPP_CHAINER_FOR(MyChainableMockObject_void, chainable) chain(&mcm); - try + MOCKPP_TRY { mcm.chainable(); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected")) != mockpp::String::npos); } - +#endif mcm.verify(); } @@ -128,16 +129,18 @@ MOCKPP_ASSERT_TRUE(&mbd == cm.lookupID(MOCKPP_PCHAR("first-name"))->getBuilder()); MOCKPP_ASSERT_TRUE(&mbd == cm.lookupID(MOCKPP_PCHAR("second-name"))->getBuilder()); - try + MOCKPP_TRY { cm.registerUniqueID(MOCKPP_PCHAR("second-name"), 0); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch ( const mockpp::AssertionFailedError &ae ) { MOCKPP_ASSERT_TRUE(ae.getMessage().find(MOCKPP_PCHAR( "duplicate invocation named" )) != mockpp::String::npos); } +#endif cm.reset(); MOCKPP_ASSERT_TRUE(0 == cm.lookupID(MOCKPP_PCHAR("second-name"))); Index: StubSequence_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/StubSequence_test.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- StubSequence_test.cpp 26 Nov 2005 17:57:48 -0000 1.15 +++ StubSequence_test.cpp 27 Nov 2005 17:27:57 -0000 1.16 @@ -103,12 +103,13 @@ val = ss.invoke((int) 1); MOCKPP_ASSERT_TRUE(val == 56); - try + MOCKPP_TRY { ss.invoke((int)1); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("no more stubs")) @@ -119,6 +120,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif } Index: ThrowStub_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ThrowStub_test.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ThrowStub_test.cpp 26 Nov 2005 17:57:48 -0000 1.12 +++ ThrowStub_test.cpp 27 Nov 2005 17:27:57 -0000 1.13 @@ -87,12 +87,13 @@ { mockpp::ThrowableItem it ( mockpp::make_throwable( MOCKPP_STL::string( "my-item" ) ) ); mockpp::ThrowStub<int> ts( it ); - try + MOCKPP_TRY { ts.typelessInvoke(); MOCKPP_FAIL( MOCKPP_PCHAR( "Did not throw the exception" ) ); } +#ifndef MOCKPP_NO_EXCEPTIONS catch ( MOCKPP_STL::string & s ) { MOCKPP_ASSERT_TRUE( s == "my-item" ); @@ -102,6 +103,7 @@ { MOCKPP_FAIL( MOCKPP_PCHAR( "Caught unexpected exception" ) ); } +#endif } @@ -116,6 +118,7 @@ MOCKPP_FAIL( MOCKPP_PCHAR( "Did not throw the exception" ) ); } +#ifndef MOCKPP_NO_EXCEPTIONS catch ( MOCKPP_STL::string & s ) { MOCKPP_ASSERT_TRUE( s == "my-item" ); @@ -125,6 +128,7 @@ { MOCKPP_FAIL( MOCKPP_PCHAR( "Caught unexpected exception" ) ); } +#endif } @@ -133,12 +137,13 @@ mockpp::ThrowableItem it; it.take( MOCKPP_STL::string( "my-item" ) ); mockpp::ThrowStub<void> ts( it ); - try + MOCKPP_TRY { ts.typelessInvoke(); MOCKPP_FAIL( MOCKPP_PCHAR( "Did not throw the exception" ) ); } +#ifndef MOCKPP_NO_EXCEPTIONS catch ( MOCKPP_STL::string & s ) { MOCKPP_ASSERT_TRUE( s == "my-item" ); @@ -148,6 +153,7 @@ { MOCKPP_FAIL( MOCKPP_PCHAR( "Caught unexpected exception" ) ); } +#endif } Index: ChainableMockObject_2_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_2_void_test.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ChainableMockObject_2_void_test.cpp 26 Nov 2005 17:57:48 -0000 1.11 +++ ChainableMockObject_2_void_test.cpp 27 Nov 2005 17:27:57 -0000 1.12 @@ -122,35 +122,41 @@ mockpp::eq( (unsigned int) 21)) .will(mockpp::throwException<void, int>(21)); - try + MOCKPP_TRY { mcm.chainable(12, 23); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(int i) { MOCKPP_ASSERT_TRUE(i == 12); } +#endif - try + MOCKPP_TRY { mcm.chainable(32, 21); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(int i) { MOCKPP_ASSERT_TRUE(i == 21); } +#endif - try + MOCKPP_TRY { mcm.chainable(1, 2); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: ChainableMockObject_5_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_5_test.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ChainableMockObject_5_test.cpp 18 Oct 2005 20:03:54 -0000 1.11 +++ ChainableMockObject_5_test.cpp 27 Nov 2005 17:27:57 -0000 1.12 @@ -300,15 +300,17 @@ MOCKPP_ASSERT_TRUE(mcm.chainable_i(12, 23, 34, 45, 56) == 12345); MOCKPP_ASSERT_TRUE(mcm.chainable_i(65, 54, 43, 32, 21) == 54321); - try + MOCKPP_TRY { mcm.chainable_i(1, 2, 3, 4, 5); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: ChainableMockObject_1_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_1_test.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ChainableMockObject_1_test.cpp 26 Nov 2005 17:57:48 -0000 1.11 +++ ChainableMockObject_1_test.cpp 27 Nov 2005 17:27:57 -0000 1.12 @@ -117,15 +117,17 @@ MOCKPP_ASSERT_TRUE(mcm.chainable(12) == 21); MOCKPP_ASSERT_TRUE(mcm.chainable(34) == 43); - try + MOCKPP_TRY { mcm.chainable(56); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: AbstractInvocationDispatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/AbstractInvocationDispatcher_test.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- AbstractInvocationDispatcher_test.cpp 26 Nov 2005 20:16:55 -0000 1.22 +++ AbstractInvocationDispatcher_test.cpp 27 Nov 2005 17:27:57 -0000 1.23 @@ -143,16 +143,18 @@ TInvok *ti = new TInvok(); ti->match_result = false; aid.add(ti); - try + MOCKPP_TRY { aid.dispatch(ginv); MOCKPP_ASSERT_TRUE(false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch ( mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find (MOCKPP_PCHAR("unexpected")) != mockpp::String::npos); } +#endif } Index: ChainableMockMethod_1_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockMethod_1_test.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ChainableMockMethod_1_test.cpp 15 Nov 2005 19:42:18 -0000 1.10 +++ ChainableMockMethod_1_test.cpp 27 Nov 2005 17:27:57 -0000 1.11 @@ -121,15 +121,18 @@ MOCKPP_ASSERT_TRUE(mcm.chainable(12) == 21); MOCKPP_ASSERT_TRUE(mcm.chainable(34) == 43); - try + MOCKPP_TRY { mcm.chainable(56); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } + +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } @@ -156,15 +159,17 @@ mcm.chainablev(34); MOCKPP_ASSERT_EQUALS(2u, counter); - try + MOCKPP_TRY { mcm.chainablev(56); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: ChainableMockObject_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_test.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- ChainableMockObject_test.cpp 13 Nov 2005 11:53:18 -0000 1.23 +++ ChainableMockObject_test.cpp 27 Nov 2005 17:27:57 -0000 1.24 @@ -127,16 +127,18 @@ mcm.addPendingRecorder(MOCKPP_PCHAR("id-1"), 0); mcm.addPendingRecorder(MOCKPP_PCHAR("id-2"), 0); - try + MOCKPP_TRY { mcm.checkPendingRecorders(); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("id-1")) != mockpp::String::npos); MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("id-2")) != mockpp::String::npos); } +#endif } @@ -169,15 +171,17 @@ MOCKPP_CHAINER_FOR(MyChainableMockObject, chainable_a) chain(&mcm); - try + MOCKPP_TRY { mcm.chainable_a(); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected")) != mockpp::String::npos); } +#endif mcm.verify(); } @@ -224,16 +228,18 @@ MOCKPP_ASSERT_TRUE(&mbd1 == cm.lookupID(MOCKPP_PCHAR("first-name"))->getBuilder()); MOCKPP_ASSERT_TRUE(&mbd2 == cm.lookupID(MOCKPP_PCHAR("second-name"))->getBuilder()); - try + MOCKPP_TRY { cm.registerUniqueID(MOCKPP_PCHAR("second-name"), 0); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch ( const mockpp::AssertionFailedError &ae ) { MOCKPP_ASSERT_TRUE(ae.getMessage().find(MOCKPP_PCHAR( "duplicate invocation named" )) != mockpp::String::npos); } +#endif cm.reset(); MOCKPP_ASSERT_TRUE(0 == cm.lookupID(MOCKPP_PCHAR("second-name"))); @@ -332,11 +338,12 @@ .will(mockpp::returnValue<int>(456)) .id(MOCKPP_PCHAR("chainable-b")); - try + MOCKPP_TRY { mcm.chainable_a(); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { mockpp::String s = ex.getMessage(); @@ -344,6 +351,7 @@ MOCKPP_ASSERT_TRUE(s.find(MOCKPP_PCHAR("(not invoked)")) != mockpp::String::npos); MOCKPP_ASSERT_TRUE(s.find(MOCKPP_PCHAR("chainable-b")) != mockpp::String::npos); } +#endif } @@ -438,11 +446,12 @@ .id(MOCKPP_PCHAR("chainable-b")); MOCKPP_ASSERT_TRUE(mcm.chainable_b() == 456); - try + MOCKPP_TRY { mcm.chainable_a(); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { mockpp::String s = ex.getMessage(); @@ -450,6 +459,7 @@ MOCKPP_ASSERT_TRUE(s.find(MOCKPP_PCHAR("before")) != mockpp::String::npos); MOCKPP_ASSERT_TRUE(s.find(MOCKPP_PCHAR("chainable-b")) != mockpp::String::npos); } +#endif } Index: ChainableMockObject_3_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_3_test.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ChainableMockObject_3_test.cpp 26 Nov 2005 17:57:48 -0000 1.9 +++ ChainableMockObject_3_test.cpp 27 Nov 2005 17:27:57 -0000 1.10 @@ -120,15 +120,17 @@ MOCKPP_ASSERT_TRUE(mcm.chainable(12, 34, 56) == 123456); MOCKPP_ASSERT_TRUE(mcm.chainable(65, 43, 21) == 654321); - try + MOCKPP_TRY { mcm.chainable(1, 2, 3); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: ChainableMockObject_4_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_4_void_test.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ChainableMockObject_4_void_test.cpp 26 Nov 2005 17:57:48 -0000 1.11 +++ ChainableMockObject_4_void_test.cpp 27 Nov 2005 17:27:57 -0000 1.12 @@ -126,35 +126,41 @@ mockpp::eq( (unsigned int) 21)) .will(mockpp::throwException<void, int>(4321)); - try + MOCKPP_TRY { mcm.chainable(12, 23, 34, 45); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(int i) { MOCKPP_ASSERT_TRUE(i == 1234); } +#endif - try + MOCKPP_TRY { mcm.chainable(54, 43, 32, 21); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(int i) { MOCKPP_ASSERT_TRUE(i == 4321); } +#endif - try + MOCKPP_TRY { mcm.chainable(1, 2, 3, 4); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: compilecheck.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/compilecheck.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- compilecheck.cpp 27 Feb 2005 11:48:16 -0000 1.23 +++ compilecheck.cpp 27 Nov 2005 17:27:57 -0000 1.24 @@ -64,7 +64,7 @@ virtual void verify() { - // throw AssertionFailedError(); + // MOCKPP_THROW(AssertionFailedError()); } }; @@ -99,7 +99,7 @@ virtual void verify() { - // throw AssertionFailedException(); + // MOCKPP_THROW(AssertionFailedException()); } }; @@ -142,7 +142,7 @@ virtual void verify() { - // throw AssertionFailedException(); + // MOCKPP_THROW(AssertionFailedException()); } }; @@ -312,7 +312,7 @@ try { std::cout << "throw?\n"; - throw ex; + MOCKPP_THROW(ex); } catch(std::exception *ex) { Index: AbstractDynamicChainingMock_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/AbstractDynamicChainingMock_test.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- AbstractDynamicChainingMock_test.cpp 18 Oct 2005 20:03:53 -0000 1.32 +++ AbstractDynamicChainingMock_test.cpp 27 Nov 2005 17:27:57 -0000 1.33 @@ -264,18 +264,19 @@ md1->enable_except = false; cmd.verify(); - try + MOCKPP_TRY { md1->enable_except = true; cmd.verify(); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("did not throw the exception"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch (mockpp::AssertionFailedError &ex ) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("dummy-verify")) != mockpp::String::npos ); MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("adc-name")) != mockpp::String::npos ); } - +#endif md1->enable_except = false; cmd.verify(); } @@ -308,29 +309,33 @@ md1->invocation_result = 5; MOCKPP_ASSERT_TRUE(cmd.invoke(inv) == 5); - try + MOCKPP_TRY { md1->enable_except = true; cmd.invoke(inv); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("did not throw the exception"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch (mockpp::AssertionFailedError &ex ) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("invoke-fail")) != mockpp::String::npos ); MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("adc-name")) != mockpp::String::npos ); } +#endif md1->enable_except = false; - try + MOCKPP_TRY { cmd.invoke(inv); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("did not throw the exception"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch (mockpp::AssertionFailedError &ex ) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("invoke-fail")) != mockpp::String::npos ); MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("adc-name")) != mockpp::String::npos ); } +#endif cmd.reset(); cmd.invoke(inv); @@ -381,30 +386,34 @@ MOCKPP_ASSERT_TRUE(md1->is_invoke == true); MOCKPP_ASSERT_TRUE(store->invoked == false); - try + MOCKPP_TRY { md1->enable_except = true; cmd.void_invoke(inv); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("did not throw the exception"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch (mockpp::AssertionFailedError &ex ) { mockpp::String s = ex.getMessage(); MOCKPP_ASSERT_TRUE(s.find(MOCKPP_PCHAR("invoke-fail")) != mockpp::String::npos ); MOCKPP_ASSERT_TRUE(s.find(MOCKPP_PCHAR("adc-name")) != mockpp::String::npos ); } +#endif md1->enable_except = false; - try + MOCKPP_TRY { cmd.void_invoke(inv); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("did not throw the exception"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch (mockpp::AssertionFailedError &ex ) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("invoke-fail")) != mockpp::String::npos ); MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("adc-name")) != mockpp::String::npos ); } +#endif cmd.reset(); cmd.void_invoke(inv); Index: ChainingMockBuilder_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainingMockBuilder_test.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- ChainingMockBuilder_test.cpp 26 Nov 2005 17:57:48 -0000 1.20 +++ ChainingMockBuilder_test.cpp 27 Nov 2005 17:27:57 -0000 1.21 @@ -261,29 +261,32 @@ cm.lookupID(MOCKPP_PCHAR("first-name")); cm.lookupID(MOCKPP_PCHAR("second-name")); - try + MOCKPP_TRY { cm.registerUniqueID(MOCKPP_PCHAR("second-name"), 0); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch ( const mockpp::AssertionFailedError &ae ) { MOCKPP_ASSERT_TRUE(ae.getMessage().find(MOCKPP_PCHAR( "duplicate invocation named" )) != mockpp::String::npos); } - +#endif cm.reset(); - try + MOCKPP_TRY { cm.lookupID(MOCKPP_PCHAR("second-name")); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch ( const mockpp::AssertionFailedError &ae ) { MOCKPP_ASSERT_TRUE(ae.getMessage().find(MOCKPP_PCHAR( "no expected invocation named" )) != mockpp::String::npos); } +#endif } Index: InvokeAtLeastMatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/InvokeAtLeastMatcher_test.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- InvokeAtLeastMatcher_test.cpp 15 Oct 2005 15:40:58 -0000 1.5 +++ InvokeAtLeastMatcher_test.cpp 27 Nov 2005 17:27:57 -0000 1.6 @@ -65,12 +65,13 @@ MOCKPP_ASSERT_TRUE(ir.matches() == true); MOCKPP_ASSERT_TRUE(ir.hasBeenInvoked() == false); - try + MOCKPP_TRY { ir.verify(); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("not invoked often enough")) @@ -81,16 +82,18 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif ir.incInvoked(); MOCKPP_ASSERT_TRUE(ir.hasBeenInvoked() == true); - try + MOCKPP_TRY { ir.verify(); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("not invoked often enough")) @@ -101,6 +104,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif MOCKPP_ASSERT_TRUE(ir.matches() == true); MOCKPP_ASSERT_TRUE(ir.hasBeenInvoked() == true); Index: InvokeAtLeastOnceMatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/InvokeAtLeastOnceMatcher_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- InvokeAtLeastOnceMatcher_test.cpp 15 Oct 2005 15:40:58 -0000 1.8 +++ InvokeAtLeastOnceMatcher_test.cpp 27 Nov 2005 17:27:57 -0000 1.9 @@ -63,12 +63,13 @@ mockpp::InvokeAtLeastOnceMatcher ir; MOCKPP_ASSERT_TRUE(ir.matches() == true); - try + MOCKPP_TRY { ir.verify(); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("was not invoked")) @@ -79,6 +80,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif mockpp::String s = MOCKPP_PCHAR("hallo"); MOCKPP_ASSERT_TRUE(ir.describeTo(s).find(MOCKPP_PCHAR("at least once")) != mockpp::String::npos); Index: ChainableMockObject_1_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_1_void_test.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- ChainableMockObject_1_void_test.cpp 26 Nov 2005 17:57:48 -0000 1.14 +++ ChainableMockObject_1_void_test.cpp 27 Nov 2005 17:27:57 -0000 1.15 @@ -120,35 +120,41 @@ .with(mockpp::eq( (unsigned int) 21)) .will(mockpp::throwException<void, int>(12)); - try + MOCKPP_TRY { mcm.chainable(12); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(int i) { MOCKPP_ASSERT_TRUE(i == 21); } +#endif - try + MOCKPP_TRY { mcm.chainable(21); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(int i) { MOCKPP_ASSERT_TRUE(i == 12); } +#endif - try + MOCKPP_TRY { mcm.chainable(9); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: TypelessStubSequence_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/TypelessStubSequence_test.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- TypelessStubSequence_test.cpp 26 Nov 2005 17:57:48 -0000 1.5 +++ TypelessStubSequence_test.cpp 27 Nov 2005 17:27:57 -0000 1.6 @@ -103,12 +103,13 @@ val = ss.typelessInvoke(); MOCKPP_ASSERT_TRUE(val == 56); - try + MOCKPP_TRY { ss.typelessInvoke(); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("no more stubs")) @@ -119,6 +120,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif } Index: ChainableMockMethod_2_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockMethod_2_test.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ChainableMockMethod_2_test.cpp 18 Nov 2005 10:49:31 -0000 1.9 +++ ChainableMockMethod_2_test.cpp 27 Nov 2005 17:27:57 -0000 1.10 @@ -122,15 +122,17 @@ MOCKPP_ASSERT_TRUE(mcm.chainable(12, 23) == 21); MOCKPP_ASSERT_TRUE(mcm.chainable(34, 45) == 43); - try + MOCKPP_TRY { mcm.chainable(56, 67); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } @@ -164,15 +166,17 @@ mcm.chainablev(34, 45); MOCKPP_ASSERT_EQUALS(2u, counter); - try + MOCKPP_TRY { mcm.chainablev(56, 67); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: InvokedAfterMatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/InvokedAfterMatcher_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- InvokedAfterMatcher_test.cpp 15 Oct 2005 15:40:58 -0000 1.8 +++ InvokedAfterMatcher_test.cpp 27 Nov 2005 17:27:57 -0000 1.9 @@ -66,12 +66,13 @@ MOCKPP_ASSERT_TRUE(iam.matches(1) == false); MOCKPP_ASSERT_TRUE(iam.hasDescription() == true); - try + MOCKPP_TRY { iam.incInvoked(1); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("called out of order")) @@ -82,6 +83,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif mockpp::String s = MOCKPP_PCHAR("hallo"); MOCKPP_ASSERT_TRUE(iam.describeTo(s) == MOCKPP_PCHAR("halloafter aftermatch (not invoked)")); Index: TestFailureStub_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/TestFailureStub_test.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- TestFailureStub_test.cpp 30 Dec 2004 20:54:06 -0000 1.6 +++ TestFailureStub_test.cpp 27 Nov 2005 17:27:57 -0000 1.7 @@ -75,12 +75,13 @@ void TestFailureStub_test::test_invoke() { mockpp::TestFailureStub<int, int> ts(MOCKPP_PCHAR("my-description")); - try + MOCKPP_TRY { ts.invoke((int)1); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("my-description")) @@ -91,6 +92,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif } Index: InvokeOnceMatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/InvokeOnceMatcher_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- InvokeOnceMatcher_test.cpp 15 Oct 2005 15:40:58 -0000 1.8 +++ InvokeOnceMatcher_test.cpp 27 Nov 2005 17:27:57 -0000 1.9 @@ -62,12 +62,13 @@ { mockpp::InvokeOnceMatcher ir; - try + MOCKPP_TRY { ir.verify(); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("was not invoked")) @@ -78,6 +79,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif mockpp::String s = MOCKPP_PCHAR("hallo"); MOCKPP_ASSERT_TRUE(ir.describeTo(s).find(MOCKPP_PCHAR("expected once")) != mockpp::String::npos); Index: VerifyingTestCaller_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VerifyingTestCaller_test.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- VerifyingTestCaller_test.cpp 26 Nov 2005 17:57:48 -0000 1.7 +++ VerifyingTestCaller_test.cpp 27 Nov 2005 17:27:57 -0000 1.8 @@ -108,7 +108,7 @@ void thrower() { - throw 1; + MOCKPP_THROW(1); } }; Index: ChainableMockObject_3_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_3_void_test.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ChainableMockObject_3_void_test.cpp 26 Nov 2005 17:57:48 -0000 1.11 +++ ChainableMockObject_3_void_test.cpp 27 Nov 2005 17:27:57 -0000 1.12 @@ -123,35 +123,41 @@ mockpp::eq( (unsigned int) 21)) .will(mockpp::throwException<void, int>(321)); - try + MOCKPP_TRY { mcm.chainable(12, 23, 34); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(int i) { MOCKPP_ASSERT_TRUE(i == 123); } +#endif - try + MOCKPP_TRY { mcm.chainable(43, 32, 21); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(int i) { MOCKPP_ASSERT_TRUE(i == 321); } +#endif - try + MOCKPP_TRY { mcm.chainable(1, 2, 3); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: ChainableMockObject_2_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_2_test.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ChainableMockObject_2_test.cpp 26 Nov 2005 17:57:48 -0000 1.10 +++ ChainableMockObject_2_test.cpp 27 Nov 2005 17:27:57 -0000 1.11 @@ -117,15 +117,17 @@ MOCKPP_ASSERT_TRUE(mcm.chainable(12, 34) == 1234); MOCKPP_ASSERT_TRUE(mcm.chainable(43, 21) == 4321); - try + MOCKPP_TRY { mcm.chainable(1, 2); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: ChainableMockMethod_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockMethod_test.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ChainableMockMethod_test.cpp 15 Nov 2005 19:42:18 -0000 1.12 +++ ChainableMockMethod_test.cpp 27 Nov 2005 17:27:57 -0000 1.13 @@ -162,15 +162,17 @@ MOCKPP_ASSERT_TRUE(mcm.chainable() == 21); MOCKPP_ASSERT_TRUE(mcm.chainable() == 43); - try + MOCKPP_TRY { mcm.chainable(); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } @@ -195,15 +197,17 @@ mcm.chainablev(); MOCKPP_ASSERT_EQUALS(2u, counter); - try + MOCKPP_TRY { mcm.chainablev(); MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &ex) { MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); } +#endif mcm.verify(); } Index: InvokeCountMatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/InvokeCountMatcher_test.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- InvokeCountMatcher_test.cpp 15 Oct 2005 15:40:58 -0000 1.9 +++ InvokeCountMatcher_test.cpp 27 Nov 2005 17:27:57 -0000 1.10 @@ -62,12 +62,13 @@ { mockpp::InvokeCountMatcher ir(1); - try + MOCKPP_TRY { ir.verify(); MOCKPP_FAIL(MOCKPP_PCHAR("Did not throw the exception")); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(mockpp::AssertionFailedError &x) { MOCKPP_ASSERT_TRUE(x.getMessage().find(MOCKPP_PCHAR("was not invoked")) @@ -78,6 +79,7 @@ { MOCKPP_FAIL(MOCKPP_PCHAR("Caught unexpected exception")); } +#endif MOCKPP_ASSERT_TRUE(ir.matches() == true); MOCKPP_ASSERT_TRUE(ir.hasDescription()); |