mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 02:55:50 +00:00
Add ProtectedCallTests
This commit is contained in:
@@ -289,7 +289,7 @@ void ProtectedCall::setHandler (Handler const& handler)
|
||||
s_handler->set (&handler);
|
||||
}
|
||||
|
||||
void ProtectedCall::call (Call& call)
|
||||
void ProtectedCall::call (Call& c)
|
||||
{
|
||||
static DefaultHandler const defaultHandler;
|
||||
|
||||
@@ -300,7 +300,7 @@ void ProtectedCall::call (Call& call)
|
||||
|
||||
try
|
||||
{
|
||||
call ();
|
||||
c ();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -309,3 +309,26 @@ void ProtectedCall::call (Call& call)
|
||||
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;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_P_H_INCLUDED
|
||||
#ifndef BEAST_PROTECTEDCALL_H_INCLUDED
|
||||
#define BEAST_PROTECTEDCALL_H_INCLUDED
|
||||
|
||||
/** Call a function in a protected exception context.
|
||||
|
||||
Reference in New Issue
Block a user