| 9135 | virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE { } |
| 9136 | |
| 9137 | virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { |
| 9138 | const AssertionResult& assertionResult = assertionStats.assertionResult; |
| 9139 | |
| 9140 | // Print any info messages in <Info> tags. |
| 9141 | if( assertionStats.assertionResult.getResultType() != ResultWas::Ok ) { |
| 9142 | for( std::vector<MessageInfo>::const_iterator it = assertionStats.infoMessages.begin(), itEnd = assertionStats.infoMessages.end(); |
| 9143 | it != itEnd; |
| 9144 | ++it ) { |
| 9145 | if( it->type == ResultWas::Info ) { |
| 9146 | m_xml.scopedElement( "Info" ) |
| 9147 | .writeText( it->message ); |
| 9148 | } else if ( it->type == ResultWas::Warning ) { |
| 9149 | m_xml.scopedElement( "Warning" ) |
| 9150 | .writeText( it->message ); |
| 9151 | } |
| 9152 | } |
| 9153 | } |
| 9154 | |
| 9155 | // Drop out if result was successful but we're not printing them. |
| 9156 | if( !m_config->includeSuccessfulResults() && isOk(assertionResult.getResultType()) ) |
| 9157 | return true; |
| 9158 | |
| 9159 | // Print the expression if there is one. |
| 9160 | if( assertionResult.hasExpression() ) { |
| 9161 | m_xml.startElement( "Expression" ) |
| 9162 | .writeAttribute( "success", assertionResult.succeeded() ) |
| 9163 | .writeAttribute( "type", assertionResult.getTestMacroName() ) |
| 9164 | .writeAttribute( "filename", assertionResult.getSourceInfo().file ) |
| 9165 | .writeAttribute( "line", assertionResult.getSourceInfo().line ); |
| 9166 | |
| 9167 | m_xml.scopedElement( "Original" ) |
| 9168 | .writeText( assertionResult.getExpression() ); |
| 9169 | m_xml.scopedElement( "Expanded" ) |
| 9170 | .writeText( assertionResult.getExpandedExpression() ); |
| 9171 | } |
| 9172 | |
| 9173 | // And... Print a result applicable to each result type. |
| 9174 | switch( assertionResult.getResultType() ) { |
| 9175 | case ResultWas::ThrewException: |
| 9176 | m_xml.scopedElement( "Exception" ) |
| 9177 | .writeAttribute( "filename", assertionResult.getSourceInfo().file ) |
| 9178 | .writeAttribute( "line", assertionResult.getSourceInfo().line ) |
| 9179 | .writeText( assertionResult.getMessage() ); |
| 9180 | break; |
| 9181 | case ResultWas::FatalErrorCondition: |
| 9182 | m_xml.scopedElement( "Fatal Error Condition" ) |
| 9183 | .writeAttribute( "filename", assertionResult.getSourceInfo().file ) |
| 9184 | .writeAttribute( "line", assertionResult.getSourceInfo().line ) |
| 9185 | .writeText( assertionResult.getMessage() ); |
| 9186 | break; |
| 9187 | case ResultWas::Info: |
| 9188 | m_xml.scopedElement( "Info" ) |
| 9189 | .writeText( assertionResult.getMessage() ); |
| 9190 | break; |
| 9191 | case ResultWas::Warning: |
| 9192 | // Warning will already have been written |
| 9193 | break; |
| 9194 | case ResultWas::ExplicitFailure: |
nothing calls this directly
no test coverage detected