mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Added signal handlers (and placeholder for SEH handlers)
- based on PR 232 (https://github.com/philsquared/Catch/pull/232 - thanks Lukasz Forynski) - Writes to reporter, so gets all the usual context, but then exits directly (since the stack cannot be resumed) so no summary - On Windows does nothing, as yet.
This commit is contained in:
@@ -109,6 +109,13 @@ namespace Catch {
|
||||
printExpressionWas();
|
||||
printRemainingMessages();
|
||||
break;
|
||||
case ResultWas::FatalErrorCondition:
|
||||
printResultType( Colour::Error, failedString() );
|
||||
printIssue( "fatal error condition with message:" );
|
||||
printMessage();
|
||||
printExpressionWas();
|
||||
printRemainingMessages();
|
||||
break;
|
||||
case ResultWas::DidntThrowException:
|
||||
printResultType( Colour::Error, failedString() );
|
||||
printIssue( "expected exception, got none" );
|
||||
|
@@ -149,6 +149,11 @@ namespace Catch {
|
||||
passOrFail = "FAILED";
|
||||
messageLabel = "due to unexpected exception with message";
|
||||
break;
|
||||
case ResultWas::FatalErrorCondition:
|
||||
colour = Colour::Error;
|
||||
passOrFail = "FAILED";
|
||||
messageLabel = "due to a fatal error condition";
|
||||
break;
|
||||
case ResultWas::DidntThrowException:
|
||||
colour = Colour::Error;
|
||||
passOrFail = "FAILED";
|
||||
|
@@ -168,6 +168,7 @@ namespace Catch {
|
||||
std::string elementName;
|
||||
switch( result.getResultType() ) {
|
||||
case ResultWas::ThrewException:
|
||||
case ResultWas::FatalErrorCondition:
|
||||
elementName = "error";
|
||||
break;
|
||||
case ResultWas::ExplicitFailure:
|
||||
|
@@ -108,6 +108,13 @@ namespace Catch {
|
||||
.writeText( assertionResult.getMessage() );
|
||||
m_currentTestSuccess = false;
|
||||
break;
|
||||
case ResultWas::FatalErrorCondition:
|
||||
m_xml.scopedElement( "Fatal Error Condition" )
|
||||
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
|
||||
.writeAttribute( "line", assertionResult.getSourceInfo().line )
|
||||
.writeText( assertionResult.getMessage() );
|
||||
m_currentTestSuccess = false;
|
||||
break;
|
||||
case ResultWas::Info:
|
||||
m_xml.scopedElement( "Info" )
|
||||
.writeText( assertionResult.getMessage() );
|
||||
|
Reference in New Issue
Block a user