blob: d05765c42643fc10caf17578b7bdf3ab6811d930 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include <cppunit/Exception.h>
#include <cppunit/extensions/TypeInfoHelper.h>
#include "DefaultProtector.h"
CPPUNIT_NS_BEGIN
bool
DefaultProtector::protect( const Functor &functor,
const ProtectorContext &context )
{
try
{
// BUG: => should return what is returned. Need to update
// UT to prove there is a bug. Consequence: runTest() is called
// even if setUp() failed in a 'sub-protector'.
functor();
return true;
// return functor();
}
catch ( Exception &failure )
{
reportFailure( context, failure );
}
catch ( std::exception &e )
{
std::string shortDescription( "uncaught exception of type " );
#if CPPUNIT_USE_TYPEINFO_NAME
shortDescription += TypeInfoHelper::getClassName( typeid(e) );
#else
shortDescription += "std::exception (or derived)."
#endif
Message message( shortDescription, e.what() );
reportError( context, message );
}
catch ( ... )
{
reportError( context,
Message( "uncaught exception of unknown type") );
}
return false;
}
CPPUNIT_NS_END
|