Add ProtectedCallTests

This commit is contained in:
Vinnie Falco
2013-07-29 15:35:27 -07:00
parent 4924707a48
commit 9d66b69376
2 changed files with 26 additions and 3 deletions

View File

@@ -289,7 +289,7 @@ void ProtectedCall::setHandler (Handler const& handler)
s_handler->set (&handler); s_handler->set (&handler);
} }
void ProtectedCall::call (Call& call) void ProtectedCall::call (Call& c)
{ {
static DefaultHandler const defaultHandler; static DefaultHandler const defaultHandler;
@@ -300,7 +300,7 @@ void ProtectedCall::call (Call& call)
try try
{ {
call (); c ();
} }
catch (...) catch (...)
{ {
@@ -309,3 +309,26 @@ void ProtectedCall::call (Call& call)
handler->onException (e); handler->onException (e);
} }
} }
//------------------------------------------------------------------------------
class ProtectedCallTests : public UnitTest
{
public:
ProtectedCallTests () : UnitTest ("ProtectedCall", "beast", runManual)
{
}
void runTest ()
{
beginTestCase ("backtrace");
pass ();
String const s = SystemStats::getStackBacktrace ();
Logger::outputDebugString (s);
}
};
static ProtectedCallTests protectedCallTests;

View File

@@ -17,7 +17,7 @@
*/ */
//============================================================================== //==============================================================================
#ifndef BEAST_P_H_INCLUDED #ifndef BEAST_PROTECTEDCALL_H_INCLUDED
#define BEAST_PROTECTEDCALL_H_INCLUDED #define BEAST_PROTECTEDCALL_H_INCLUDED
/** Call a function in a protected exception context. /** Call a function in a protected exception context.