| 10120 | virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE { } |
| 10121 | |
| 10122 | virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { |
| 10123 | |
| 10124 | AssertionResult const& result = assertionStats.assertionResult; |
| 10125 | |
| 10126 | bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); |
| 10127 | |
| 10128 | if( includeResults ) { |
| 10129 | // Print any info messages in <Info> tags. |
| 10130 | for( std::vector<MessageInfo>::const_iterator it = assertionStats.infoMessages.begin(), itEnd = assertionStats.infoMessages.end(); |
| 10131 | it != itEnd; |
| 10132 | ++it ) { |
| 10133 | if( it->type == ResultWas::Info ) { |
| 10134 | m_xml.scopedElement( "Info" ) |
| 10135 | .writeText( it->message ); |
| 10136 | } else if ( it->type == ResultWas::Warning ) { |
| 10137 | m_xml.scopedElement( "Warning" ) |
| 10138 | .writeText( it->message ); |
| 10139 | } |
| 10140 | } |
| 10141 | } |
| 10142 | |
| 10143 | // Drop out if result was successful but we're not printing them. |
| 10144 | if( !includeResults && result.getResultType() != ResultWas::Warning ) |
| 10145 | return true; |
| 10146 | |
| 10147 | // Print the expression if there is one. |
| 10148 | if( result.hasExpression() ) { |
| 10149 | m_xml.startElement( "Expression" ) |
| 10150 | .writeAttribute( "success", result.succeeded() ) |
| 10151 | .writeAttribute( "type", result.getTestMacroName() ); |
| 10152 | |
| 10153 | writeSourceInfo( result.getSourceInfo() ); |
| 10154 | |
| 10155 | m_xml.scopedElement( "Original" ) |
| 10156 | .writeText( result.getExpression() ); |
| 10157 | m_xml.scopedElement( "Expanded" ) |
| 10158 | .writeText( result.getExpandedExpression() ); |
| 10159 | } |
| 10160 | |
| 10161 | // And... Print a result applicable to each result type. |
| 10162 | switch( result.getResultType() ) { |
| 10163 | case ResultWas::ThrewException: |
| 10164 | m_xml.startElement( "Exception" ); |
| 10165 | writeSourceInfo( result.getSourceInfo() ); |
| 10166 | m_xml.writeText( result.getMessage() ); |
| 10167 | m_xml.endElement(); |
| 10168 | break; |
| 10169 | case ResultWas::FatalErrorCondition: |
| 10170 | m_xml.startElement( "FatalErrorCondition" ); |
| 10171 | writeSourceInfo( result.getSourceInfo() ); |
| 10172 | m_xml.writeText( result.getMessage() ); |
| 10173 | m_xml.endElement(); |
| 10174 | break; |
| 10175 | case ResultWas::Info: |
| 10176 | m_xml.scopedElement( "Info" ) |
| 10177 | .writeText( result.getMessage() ); |
| 10178 | break; |
| 10179 | case ResultWas::Warning: |
nothing calls this directly
no test coverage detected