Changed the way info messages are handled.

This fixes issue with SCOPED_INFO and makes output more readable.
Needs some refactoring.
This commit is contained in:
Phil Nash 2013-02-02 19:58:04 +00:00
parent d658dea1dd
commit 207b27b3c5
16 changed files with 334 additions and 301 deletions

View File

@ -11,7 +11,10 @@ baselinesPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/approvedRe
rawResultsPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/_rawResults.tmp' ) rawResultsPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/_rawResults.tmp' )
filteredResultsPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/unapprovedResults.txt' ) filteredResultsPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/unapprovedResults.txt' )
cmdPath = sys.argv[1] if len(sys.argv) == 2:
cmdPath = sys.argv[1]
else:
cmdPath = "projects/XCode4/CatchSelfTest/DerivedData/CatchSelfTest/Build/Products/Debug/CatchSelfTest"
f = open( rawResultsPath, 'w' ) f = open( rawResultsPath, 'w' )
subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "console" ], stdout=f, stderr=f ) subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "console" ], stdout=f, stderr=f )

View File

@ -68,12 +68,12 @@
#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THAT" ) #define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THAT" )
#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::Normal, "CATCH_REQUIRE_THAT" ) #define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::Normal, "CATCH_REQUIRE_THAT" )
#define CATCH_INFO( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Info, Catch::ResultDisposition::ContinueOnFailure, "CATCH_INFO" ) #define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( msg, "CATCH_INFO" )
#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "CATCH_WARN" ) #define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "CATCH_WARN" )
#define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL" ) #define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL" )
#define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED" ) #define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED" )
#define CATCH_SCOPED_INFO( msg ) INTERNAL_CATCH_SCOPED_INFO( msg, "CATCH_SCOPED_INFO" ) #define CATCH_SCOPED_INFO( msg ) INTERNAL_CATCH_SCOPED_INFO( msg, "CATCH_SCOPED_INFO" )
#define CATCH_CAPTURE( msg ) INTERNAL_CATCH_MSG( #msg " := " << msg, Catch::ResultWas::Info, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CAPTURE" ) #define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CATCH_CAPTURE" )
#define CATCH_SCOPED_CAPTURE( msg ) INTERNAL_CATCH_SCOPED_INFO( #msg " := " << msg, "CATCH_SCOPED_CAPTURE" ) #define CATCH_SCOPED_CAPTURE( msg ) INTERNAL_CATCH_SCOPED_INFO( #msg " := " << msg, "CATCH_SCOPED_CAPTURE" )
#define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description ) #define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
@ -111,12 +111,12 @@
#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::ContinueOnFailure, "CHECK_THAT" ) #define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::ContinueOnFailure, "CHECK_THAT" )
#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::Normal, "REQUIRE_THAT" ) #define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::Normal, "REQUIRE_THAT" )
#define INFO( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Info, Catch::ResultDisposition::ContinueOnFailure, "INFO" ) #define INFO( msg ) INTERNAL_CATCH_INFO( msg, "INFO" )
#define WARN( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "WARN" ) #define WARN( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "WARN" )
#define FAIL( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL" ) #define FAIL( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL" )
#define SUCCEED( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED" ) #define SUCCEED( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED" )
#define SCOPED_INFO( msg ) INTERNAL_CATCH_SCOPED_INFO( msg, "SCOPED_INFO" ) #define SCOPED_INFO( msg ) INTERNAL_CATCH_SCOPED_INFO( msg, "SCOPED_INFO" )
#define CAPTURE( msg ) INTERNAL_CATCH_MSG( #msg " := " << msg, Catch::ResultWas::Info, Catch::ResultDisposition::ContinueOnFailure, "CAPTURE" ) #define CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CAPTURE" )
#define SCOPED_CAPTURE( msg ) INTERNAL_CATCH_SCOPED_INFO( #msg " := " << msg, "SCOPED_CAPTURE" ) #define SCOPED_CAPTURE( msg ) INTERNAL_CATCH_SCOPED_INFO( #msg " := " << msg, "SCOPED_CAPTURE" )
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description ) #define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )

View File

@ -10,6 +10,7 @@
#include "catch_expression_decomposer.hpp" #include "catch_expression_decomposer.hpp"
#include "catch_expressionresult_builder.h" #include "catch_expressionresult_builder.h"
#include "catch_message.h"
#include "catch_interfaces_capture.h" #include "catch_interfaces_capture.h"
#include "catch_debugger.hpp" #include "catch_debugger.hpp"
#include "catch_context.h" #include "catch_context.h"
@ -54,26 +55,6 @@ namespace Catch {
struct TestFailureException{}; struct TestFailureException{};
class ScopedInfo {
public:
ScopedInfo() : m_resultBuilder( ResultWas::Info ) {
getResultCapture().pushScopedInfo( this );
}
~ScopedInfo() {
getResultCapture().popScopedInfo( this );
}
template<typename T>
ScopedInfo& operator << ( const T& value ) {
m_resultBuilder << value;
return *this;
}
AssertionResult buildResult( const AssertionInfo& assertionInfo ) const {
return m_resultBuilder.buildResult( assertionInfo );
}
private:
ExpressionResultBuilder m_resultBuilder;
};
// This is just here to avoid compiler warnings with macro constants and boolean literals // This is just here to avoid compiler warnings with macro constants and boolean literals
inline bool isTrue( bool value ){ return value; } inline bool isTrue( bool value ){ return value; }
@ -168,17 +149,24 @@ inline bool isTrue( bool value ){ return value; }
} while( Catch::isTrue( false ) ) } while( Catch::isTrue( false ) )
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_MSG( reason, resultType, resultDisposition, macroName ) \ #define INTERNAL_CATCH_INFO( log, macroName ) \
do { \
Catch::getResultCapture().acceptMessage( Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ); \
} while( Catch::isTrue( false ) )
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_MSG( log, messageType, resultDisposition, macroName ) \
do { \ do { \
INTERNAL_CATCH_ACCEPT_INFO( "", macroName, resultDisposition ); \ INTERNAL_CATCH_ACCEPT_INFO( "", macroName, resultDisposition ); \
INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( resultType ) << reason, resultDisposition, true ) \ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( messageType ) << log, resultDisposition, true ) \
} while( Catch::isTrue( false ) ) } while( Catch::isTrue( false ) )
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_SCOPED_INFO( log, macroName ) \ #define INTERNAL_CATCH_SCOPED_INFO( log, macroName ) \
INTERNAL_CATCH_ACCEPT_INFO( "", macroName, Catch::ResultDisposition::Normal ); \ Catch::ScopedMessageBuilder INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ); \
Catch::ScopedInfo INTERNAL_CATCH_UNIQUE_NAME( info ); \ INTERNAL_CATCH_UNIQUE_NAME( scopedMessage ) << log; \
INTERNAL_CATCH_UNIQUE_NAME( info ) << log Catch::getResultCapture().pushScopedMessage( INTERNAL_CATCH_UNIQUE_NAME( scopedMessage ) )
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CHECK_THAT( arg, matcher, resultDisposition, macroName ) \ #define INTERNAL_CHECK_THAT( arg, matcher, resultDisposition, macroName ) \

View File

@ -148,7 +148,7 @@ namespace Catch {
virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) = 0; virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) = 0;
virtual std::string argsSynopsis() const = 0; virtual std::string argsSynopsis() const = 0;
virtual std::string optionSummary() const = 0; virtual std::string optionSummary() const = 0;
virtual std::string optionDescription() const { return ""; }; virtual std::string optionDescription() const { return ""; }
std::string optionNames() const { std::string optionNames() const {
std::string names; std::string names;

View File

@ -28,6 +28,7 @@
#include "catch_tags.hpp" #include "catch_tags.hpp"
#include "catch_version.hpp" #include "catch_version.hpp"
#include "catch_line_wrap.hpp" #include "catch_line_wrap.hpp"
#include "catch_message.hpp"
#include "../reporters/catch_reporter_basic.hpp" #include "../reporters/catch_reporter_basic.hpp"
#include "../reporters/catch_reporter_xml.hpp" #include "../reporters/catch_reporter_xml.hpp"

View File

@ -21,19 +21,25 @@ namespace Catch {
class AssertionResult; class AssertionResult;
struct AssertionInfo; struct AssertionInfo;
struct SectionInfo; struct SectionInfo;
class MessageBuilder;
class ScopedMessageBuilder;
struct IResultCapture { struct IResultCapture {
virtual ~IResultCapture(); virtual ~IResultCapture();
virtual void testEnded( AssertionResult const& result ) = 0; virtual void assertionEnded( AssertionResult const& result ) = 0;
virtual bool sectionStarted( SectionInfo const& sectionInfo, virtual bool sectionStarted( SectionInfo const& sectionInfo,
Counts& assertions ) = 0; Counts& assertions ) = 0;
virtual void sectionEnded( SectionInfo const& name, Counts const& assertions ) = 0; virtual void sectionEnded( SectionInfo const& name, Counts const& assertions ) = 0;
virtual void pushScopedInfo( ScopedInfo* scopedInfo ) = 0; virtual void pushScopedInfo( ScopedInfo* scopedInfo ) = 0; // !TBD Deprecated
virtual void popScopedInfo( ScopedInfo* scopedInfo ) = 0; virtual void popScopedInfo( ScopedInfo* scopedInfo ) = 0; // !TBD Deprecated
virtual void pushScopedMessage( ScopedMessageBuilder const& _builder ) = 0;
virtual void popScopedMessage( ScopedMessageBuilder const& _builder ) = 0;
virtual bool shouldDebugBreak() const = 0; virtual bool shouldDebugBreak() const = 0;
virtual void acceptMessage( const MessageBuilder& messageBuilder ) = 0;
virtual ResultAction::Value acceptExpression( ExpressionResultBuilder const& assertionResult, AssertionInfo const& assertionInfo ) = 0; virtual ResultAction::Value acceptExpression( ExpressionResultBuilder const& assertionResult, AssertionInfo const& assertionInfo ) = 0;
virtual std::string getCurrentTestName() const = 0; virtual std::string getCurrentTestName() const = 0;

View File

@ -14,6 +14,7 @@
#include "catch_config.hpp" #include "catch_config.hpp"
#include "catch_test_case_info.h" #include "catch_test_case_info.h"
#include "catch_assertionresult.h" #include "catch_assertionresult.h"
#include "catch_message.h"
#include "catch_option.hpp" #include "catch_option.hpp"
#include <string> #include <string>
@ -89,13 +90,24 @@ namespace Catch
struct AssertionStats { struct AssertionStats {
AssertionStats( AssertionResult const& _assertionResult, AssertionStats( AssertionResult const& _assertionResult,
std::vector<MessageInfo> const& _infoMessages,
Totals const& _totals ) Totals const& _totals )
: assertionResult( _assertionResult ), : assertionResult( _assertionResult ),
infoMessages( _infoMessages ),
totals( _totals ) totals( _totals )
{} {
if( assertionResult.hasMessage() ) {
// Copy message into messages list.
// !TBD This should have been done earlier, somewhere
MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );
builder << assertionResult.getMessage();
infoMessages.push_back( builder.build() );
}
}
virtual ~AssertionStats(); virtual ~AssertionStats();
AssertionResult assertionResult; AssertionResult assertionResult;
std::vector<MessageInfo> infoMessages;
Totals totals; Totals totals;
}; };

View File

@ -0,0 +1,66 @@
/*
* Created by Phil Nash on 1/2/2013.
* Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef TWOBLUECUBES_CATCH_MESSAGE_H_INCLUDED
#define TWOBLUECUBES_CATCH_MESSAGE_H_INCLUDED
#include <string>
#include "catch_result_type.h"
#include "catch_common.h"
namespace Catch {
struct MessageInfo {
MessageInfo( std::string const& _macroName,
SourceLineInfo const& _lineInfo,
ResultWas::OfType _type );
std::string macroName;
SourceLineInfo lineInfo;
ResultWas::OfType type;
std::string message;
unsigned int sequence;
bool operator == ( MessageInfo const& other ) const {
return sequence == other.sequence;
}
bool operator < ( MessageInfo const& other ) const {
return sequence < other.sequence;
}
private:
static unsigned int globalCount;
};
class MessageBuilder : public MessageInfo {
public:
MessageBuilder( std::string const& _macroName,
SourceLineInfo const& _lineInfo,
ResultWas::OfType _type );
MessageInfo build() const;
template<typename T>
MessageBuilder& operator << ( T const& _value ) {
stream << _value;
return *this;
}
private:
std::ostringstream stream;
};
class ScopedMessageBuilder : public MessageBuilder {
public:
ScopedMessageBuilder( std::string const& _macroName,
SourceLineInfo const& _lineInfo,
ResultWas::OfType _type );
~ScopedMessageBuilder();
};
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_MESSAGE_H_INCLUDED

View File

@ -0,0 +1,57 @@
/*
* Created by Phil Nash on 1/2/2013.
* Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef TWOBLUECUBES_CATCH_MESSAGE_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_MESSAGE_HPP_INCLUDED
#include "catch_message.h"
namespace Catch {
MessageInfo::MessageInfo( std::string const& _macroName,
SourceLineInfo const& _lineInfo,
ResultWas::OfType _type )
: macroName( _macroName ),
lineInfo( _lineInfo ),
type( _type ),
sequence( ++globalCount )
{}
// This may need protecting if threading support is added
unsigned int MessageInfo::globalCount = 0;
////////////////////////////////////////////////////////////////////////////
MessageBuilder::MessageBuilder( std::string const& _macroName,
SourceLineInfo const& _lineInfo,
ResultWas::OfType _type )
: MessageInfo( _macroName, _lineInfo, _type )
{}
MessageInfo MessageBuilder::build() const {
MessageInfo message = *this;
message.message = stream.str();
return message;
}
////////////////////////////////////////////////////////////////////////////
ScopedMessageBuilder::ScopedMessageBuilder
( std::string const& _macroName,
SourceLineInfo const& _lineInfo,
ResultWas::OfType _type )
: MessageBuilder( _macroName, _lineInfo, _type )
{}
ScopedMessageBuilder::~ScopedMessageBuilder() {
getResultCapture().popScopedMessage( *this );
}
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_MESSAGE_HPP_INCLUDED

View File

@ -32,6 +32,9 @@ namespace Catch {
inline bool isOk( ResultWas::OfType resultType ) { inline bool isOk( ResultWas::OfType resultType ) {
return ( resultType & ResultWas::FailureBit ) == 0; return ( resultType & ResultWas::FailureBit ) == 0;
} }
inline bool isJustInfo( int flags ) {
return flags == ResultWas::Info;
}
// ResultAction::Value enum // ResultAction::Value enum
struct ResultAction { enum Value { struct ResultAction { enum Value {

View File

@ -155,43 +155,49 @@ namespace Catch {
private: // IResultCapture private: // IResultCapture
virtual void acceptMessage( const MessageBuilder& messageBuilder ) {
m_messages.push_back( messageBuilder.build() );
}
virtual ResultAction::Value acceptExpression( const ExpressionResultBuilder& assertionResult, const AssertionInfo& assertionInfo ) { virtual ResultAction::Value acceptExpression( const ExpressionResultBuilder& assertionResult, const AssertionInfo& assertionInfo ) {
m_lastAssertionInfo = assertionInfo; m_lastAssertionInfo = assertionInfo;
return actOnCurrentResult( assertionResult.buildResult( assertionInfo ) ); return actOnCurrentResult( assertionResult.buildResult( assertionInfo ) );
} }
virtual void testEnded( const AssertionResult& result ) { virtual void assertionEnded( const AssertionResult& result ) {
if( result.getResultType() == ResultWas::Ok ) { if( result.getResultType() == ResultWas::Ok ) {
m_totals.assertions.passed++; m_totals.assertions.passed++;
} }
else if( !result.isOk() ) { else if( !result.isOk() ) {
m_totals.assertions.failed++; m_totals.assertions.failed++;
{ // {
std::vector<ScopedInfo*>::const_iterator it = m_scopedInfos.begin(); // std::vector<ScopedInfo*>::const_iterator it = m_scopedInfos.begin();
std::vector<ScopedInfo*>::const_iterator itEnd = m_scopedInfos.end(); // std::vector<ScopedInfo*>::const_iterator itEnd = m_scopedInfos.end();
for(; it != itEnd; ++it ) // for(; it != itEnd; ++it )
m_reporter->assertionEnded( AssertionStats( (*it)->buildResult( m_lastAssertionInfo ), m_totals ) ); // m_reporter->assertionEnded( AssertionStats( (*it)->buildResult( m_lastAssertionInfo ), m_totals ) );
} // }
{ // {
std::vector<AssertionResult>::const_iterator it = m_assertionResults.begin(); // std::vector<AssertionResult>::const_iterator it = m_assertionResults.begin();
std::vector<AssertionResult>::const_iterator itEnd = m_assertionResults.end(); // std::vector<AssertionResult>::const_iterator itEnd = m_assertionResults.end();
for(; it != itEnd; ++it ) // for(; it != itEnd; ++it )
m_reporter->assertionEnded( AssertionStats( *it, m_totals ) ); // m_reporter->assertionEnded( AssertionStats( *it, m_totals ) );
} // }
m_assertionResults.clear(); // m_assertionResults.clear();
} }
if( result.getResultType() == ResultWas::Info ) if( result.getResultType() == ResultWas::Info ) {
{ // !TBD: deprecated? - what does this even do?
m_assertionResults.push_back( result ); m_assertionResults.push_back( result );
m_totals.assertions.info++; m_totals.assertions.info++;
} }
else else {
m_reporter->assertionEnded( AssertionStats( result, m_totals ) ); m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) );
}
// Reset AssertionInfo // Reset AssertionInfo
m_lastAssertionInfo = AssertionInfo( "", m_lastAssertionInfo.lineInfo, "{Unknown expression after this line}" , m_lastAssertionInfo.resultDisposition ); m_lastAssertionInfo = AssertionInfo( "", m_lastAssertionInfo.lineInfo, "{Unknown expression after the reported line}" , m_lastAssertionInfo.resultDisposition );
m_messages.clear();
} }
virtual bool sectionStarted ( virtual bool sectionStarted (
@ -229,6 +235,7 @@ namespace Catch {
m_runningTest->endSection( info.name ); m_runningTest->endSection( info.name );
m_reporter->sectionEnded( SectionStats( info, assertions, missingAssertions ) ); m_reporter->sectionEnded( SectionStats( info, assertions, missingAssertions ) );
m_messages.clear();
} }
virtual void pushScopedInfo( ScopedInfo* scopedInfo ) { virtual void pushScopedInfo( ScopedInfo* scopedInfo ) {
@ -239,6 +246,13 @@ namespace Catch {
if( m_scopedInfos.back() == scopedInfo ) if( m_scopedInfos.back() == scopedInfo )
m_scopedInfos.pop_back(); m_scopedInfos.pop_back();
} }
virtual void pushScopedMessage( ScopedMessageBuilder const& _builder ) {
m_messages.push_back( _builder.build() );
}
virtual void popScopedMessage( ScopedMessageBuilder const& _builder ) {
m_messages.erase( std::remove( m_messages.begin(), m_messages.end(), _builder ), m_messages.end() );
}
virtual bool shouldDebugBreak() const { virtual bool shouldDebugBreak() const {
return m_config.shouldDebugBreak(); return m_config.shouldDebugBreak();
@ -264,7 +278,7 @@ namespace Catch {
ResultAction::Value actOnCurrentResult( const AssertionResult& result ) { ResultAction::Value actOnCurrentResult( const AssertionResult& result ) {
m_lastResult = result; m_lastResult = result;
testEnded( m_lastResult ); assertionEnded( m_lastResult );
ResultAction::Value action = ResultAction::None; ResultAction::Value action = ResultAction::None;
@ -312,8 +326,9 @@ namespace Catch {
const Config& m_config; const Config& m_config;
Totals m_totals; Totals m_totals;
Ptr<IStreamingReporter> m_reporter; Ptr<IStreamingReporter> m_reporter;
std::vector<ScopedInfo*> m_scopedInfos; std::vector<ScopedInfo*> m_scopedInfos; // !TBD: deprecated
std::vector<AssertionResult> m_assertionResults; std::vector<AssertionResult> m_assertionResults; // !TBD: deprecated
std::vector<MessageInfo> m_messages;
IRunner* m_prevRunner; IRunner* m_prevRunner;
IResultCapture* m_prevResultCapture; IResultCapture* m_prevResultCapture;
const IConfig* m_prevConfig; const IConfig* m_prevConfig;

View File

@ -98,14 +98,18 @@ namespace Catch {
stats( _stats ), stats( _stats ),
result( _stats.assertionResult ), result( _stats.assertionResult ),
colour( TextColour::None ), colour( TextColour::None ),
message( result.getMessage() ) message( result.getMessage() ),
messages( _stats.infoMessages )
{ {
switch( result.getResultType() ) { switch( result.getResultType() ) {
case ResultWas::Ok: case ResultWas::Ok:
colour = TextColour::Success; colour = TextColour::Success;
passOrFail = "PASSED"; passOrFail = "PASSED";
if( result.hasMessage() ) //if( result.hasMessage() )
if( _stats.infoMessages.size() == 1 )
messageLabel = "with message"; messageLabel = "with message";
if( _stats.infoMessages.size() > 1 )
messageLabel = "with messages";
break; break;
case ResultWas::ExpressionFailed: case ResultWas::ExpressionFailed:
if( result.isOk() ) { if( result.isOk() ) {
@ -116,9 +120,13 @@ namespace Catch {
colour = TextColour::Error; colour = TextColour::Error;
passOrFail = "FAILED"; passOrFail = "FAILED";
} }
if( result.hasMessage() ){ if( _stats.infoMessages.size() == 1 )
messageLabel = "with message"; messageLabel = "with message";
} if( _stats.infoMessages.size() > 1 )
messageLabel = "with messages";
// if( result.hasMessage() ){
// messageLabel = "with message";
// }
break; break;
case ResultWas::ThrewException: case ResultWas::ThrewException:
colour = TextColour::Error; colour = TextColour::Error;
@ -139,13 +147,21 @@ namespace Catch {
case ResultWas::ExplicitFailure: case ResultWas::ExplicitFailure:
passOrFail = "FAILED"; passOrFail = "FAILED";
colour = TextColour::Error; colour = TextColour::Error;
// messageLabel = "explicitly with message";
if( _stats.infoMessages.size() == 1 )
messageLabel = "explicitly with message"; messageLabel = "explicitly with message";
if( _stats.infoMessages.size() > 1 )
messageLabel = "explicitly with messages";
break; break;
case ResultWas::Exception: case ResultWas::Exception:
passOrFail = "FAILED"; passOrFail = "FAILED";
colour = TextColour::Error; colour = TextColour::Error;
if( result.hasMessage() ) if( _stats.infoMessages.size() == 1 )
messageLabel = "with message"; messageLabel = "with message";
if( _stats.infoMessages.size() > 1 )
messageLabel = "with messages";
// if( result.hasMessage() )
// messageLabel = "with message";
break; break;
// These cases are here to prevent compiler warnings // These cases are here to prevent compiler warnings
@ -196,8 +212,13 @@ namespace Catch {
void printMessage() const { void printMessage() const {
if( !messageLabel.empty() ) if( !messageLabel.empty() )
stream << messageLabel << ":" << "\n"; stream << messageLabel << ":" << "\n";
if( !message.empty() ) for( std::vector<MessageInfo>::const_iterator it = messages.begin(), itEnd = messages.end();
stream << wrapLongStrings( message ) << "\n"; it != itEnd;
++it ) {
stream << wrapLongStrings( it->message ) << "\n";
}
// if( !message.empty() )
// stream << wrapLongStrings( message ) << "\n";
} }
void printSourceInfo() const { void printSourceInfo() const {
TextColour colourGuard( TextColour::FileName ); TextColour colourGuard( TextColour::FileName );
@ -215,6 +236,7 @@ namespace Catch {
std::string passOrFail; std::string passOrFail;
std::string messageLabel; std::string messageLabel;
std::string message; std::string message;
std::vector<MessageInfo> messages;
}; };
void lazyPrint() { void lazyPrint() {

View File

@ -1,5 +1,5 @@
CatchSelfTest is a CATCH v0.9 b15 (integration) host application. CatchSelfTest is a CATCH v0.9 b16 (integration) host application.
Run with -? for options Run with -? for options
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -1055,7 +1055,7 @@ PASSED:
ExceptionTests.cpp:60: ExceptionTests.cpp:60:
FAILED: FAILED:
{Unknown expression after this line} {Unknown expression after the reported line}
due to unexpected exception with message: due to unexpected exception with message:
unexpected exception unexpected exception
ExceptionTests.cpp:60: ExceptionTests.cpp:60:
@ -2002,6 +2002,7 @@ GeneratorTests.cpp:40:
............................................................................... ...............................................................................
warning: warning:
this is a message
this is a warning this is a warning
MessageTests.cpp:14: MessageTests.cpp:14:
@ -2021,18 +2022,13 @@ MessageTests.cpp:18:
./failing/message/info/1 ./failing/message/info/1
............................................................................... ...............................................................................
info:
this message should be logged
MessageTests.cpp:23:
info:
so should this
MessageTests.cpp:24:
FAILED: FAILED:
REQUIRE( a == 1 ) REQUIRE( a == 1 )
with expansion: with expansion:
2 == 1 2 == 1
with messages:
this message should be logged
so should this
MessageTests.cpp:26: MessageTests.cpp:26:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -2043,36 +2039,32 @@ PASSED:
CHECK( a == 2 ) CHECK( a == 2 )
with expansion: with expansion:
2 == 2 2 == 2
MessageTests.cpp:33: with message:
info:
this message should be logged this message should be logged
MessageTests.cpp:31: MessageTests.cpp:33:
info:
this message should be logged, too
MessageTests.cpp:35:
FAILED: FAILED:
CHECK( a == 1 ) CHECK( a == 1 )
with expansion: with expansion:
2 == 1 2 == 1
with message:
this message should be logged, too
MessageTests.cpp:37: MessageTests.cpp:37:
info:
and this, but later
MessageTests.cpp:39:
FAILED: FAILED:
CHECK( a == 0 ) CHECK( a == 0 )
with expansion: with expansion:
2 == 0 2 == 0
with message:
and this, but later
MessageTests.cpp:41: MessageTests.cpp:41:
PASSED: PASSED:
CHECK( a == 2 ) CHECK( a == 2 )
with expansion: with expansion:
2 == 2 2 == 2
with message:
but not this
MessageTests.cpp:45: MessageTests.cpp:45:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -2130,76 +2122,99 @@ PASSED:
REQUIRE( i < 10 ) REQUIRE( i < 10 )
with expansion: with expansion:
0 < 10 0 < 10
with messages:
current counter 0
i := 0
MessageTests.cpp:86: MessageTests.cpp:86:
PASSED: PASSED:
REQUIRE( i < 10 ) REQUIRE( i < 10 )
with expansion: with expansion:
1 < 10 1 < 10
with messages:
current counter 1
i := 1
MessageTests.cpp:86: MessageTests.cpp:86:
PASSED: PASSED:
REQUIRE( i < 10 ) REQUIRE( i < 10 )
with expansion: with expansion:
2 < 10 2 < 10
with messages:
current counter 2
i := 2
MessageTests.cpp:86: MessageTests.cpp:86:
PASSED: PASSED:
REQUIRE( i < 10 ) REQUIRE( i < 10 )
with expansion: with expansion:
3 < 10 3 < 10
with messages:
current counter 3
i := 3
MessageTests.cpp:86: MessageTests.cpp:86:
PASSED: PASSED:
REQUIRE( i < 10 ) REQUIRE( i < 10 )
with expansion: with expansion:
4 < 10 4 < 10
with messages:
current counter 4
i := 4
MessageTests.cpp:86: MessageTests.cpp:86:
PASSED: PASSED:
REQUIRE( i < 10 ) REQUIRE( i < 10 )
with expansion: with expansion:
5 < 10 5 < 10
with messages:
current counter 5
i := 5
MessageTests.cpp:86: MessageTests.cpp:86:
PASSED: PASSED:
REQUIRE( i < 10 ) REQUIRE( i < 10 )
with expansion: with expansion:
6 < 10 6 < 10
with messages:
current counter 6
i := 6
MessageTests.cpp:86: MessageTests.cpp:86:
PASSED: PASSED:
REQUIRE( i < 10 ) REQUIRE( i < 10 )
with expansion: with expansion:
7 < 10 7 < 10
with messages:
current counter 7
i := 7
MessageTests.cpp:86: MessageTests.cpp:86:
PASSED: PASSED:
REQUIRE( i < 10 ) REQUIRE( i < 10 )
with expansion: with expansion:
8 < 10 8 < 10
with messages:
current counter 8
i := 8
MessageTests.cpp:86: MessageTests.cpp:86:
PASSED: PASSED:
REQUIRE( i < 10 ) REQUIRE( i < 10 )
with expansion: with expansion:
9 < 10 9 < 10
MessageTests.cpp:86: with messages:
current counter 9
REQUIRE( i < 10 ) i := 9
info:
current counter 10
MessageTests.cpp:86:
REQUIRE( i < 10 )
info:
i := 10
MessageTests.cpp:86: MessageTests.cpp:86:
FAILED: FAILED:
REQUIRE( i < 10 ) REQUIRE( i < 10 )
with expansion: with expansion:
10 < 10 10 < 10
with messages:
current counter 10
i := 10
MessageTests.cpp:86: MessageTests.cpp:86:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -2347,84 +2362,68 @@ MiscTests.cpp:103:
./mixed/Misc/loops ./mixed/Misc/loops
............................................................................... ...............................................................................
info: FAILED:
CHECK( ( fib[i] % 2 ) == 0 )
with expansion:
1 == 0
with message:
Testing if fib[0] (1) is even Testing if fib[0] (1) is even
MiscTests.cpp:114: MiscTests.cpp:115:
FAILED: FAILED:
CHECK( ( fib[i] % 2 ) == 0 ) CHECK( ( fib[i] % 2 ) == 0 )
with expansion: with expansion:
1 == 0 1 == 0
MiscTests.cpp:115: with message:
info:
Testing if fib[1] (1) is even Testing if fib[1] (1) is even
MiscTests.cpp:114:
FAILED:
CHECK( ( fib[i] % 2 ) == 0 )
with expansion:
1 == 0
MiscTests.cpp:115: MiscTests.cpp:115:
PASSED: PASSED:
CHECK( ( fib[i] % 2 ) == 0 ) CHECK( ( fib[i] % 2 ) == 0 )
with expansion: with expansion:
0 == 0 0 == 0
MiscTests.cpp:115: with message:
info:
Testing if fib[2] (2) is even Testing if fib[2] (2) is even
MiscTests.cpp:114:
info:
Testing if fib[3] (3) is even
MiscTests.cpp:114:
FAILED:
CHECK( ( fib[i] % 2 ) == 0 )
with expansion:
1 == 0
MiscTests.cpp:115: MiscTests.cpp:115:
info: FAILED:
Testing if fib[4] (5) is even CHECK( ( fib[i] % 2 ) == 0 )
MiscTests.cpp:114: with expansion:
1 == 0
with message:
Testing if fib[3] (3) is even
MiscTests.cpp:115:
FAILED: FAILED:
CHECK( ( fib[i] % 2 ) == 0 ) CHECK( ( fib[i] % 2 ) == 0 )
with expansion: with expansion:
1 == 0 1 == 0
with message:
Testing if fib[4] (5) is even
MiscTests.cpp:115: MiscTests.cpp:115:
PASSED: PASSED:
CHECK( ( fib[i] % 2 ) == 0 ) CHECK( ( fib[i] % 2 ) == 0 )
with expansion: with expansion:
0 == 0 0 == 0
MiscTests.cpp:115: with message:
info:
Testing if fib[5] (8) is even Testing if fib[5] (8) is even
MiscTests.cpp:114:
info:
Testing if fib[6] (13) is even
MiscTests.cpp:114:
FAILED:
CHECK( ( fib[i] % 2 ) == 0 )
with expansion:
1 == 0
MiscTests.cpp:115: MiscTests.cpp:115:
info: FAILED:
Testing if fib[7] (21) is even CHECK( ( fib[i] % 2 ) == 0 )
MiscTests.cpp:114: with expansion:
1 == 0
with message:
Testing if fib[6] (13) is even
MiscTests.cpp:115:
FAILED: FAILED:
CHECK( ( fib[i] % 2 ) == 0 ) CHECK( ( fib[i] % 2 ) == 0 )
with expansion: with expansion:
1 == 0 1 == 0
with message:
Testing if fib[7] (21) is even
MiscTests.cpp:115: MiscTests.cpp:115:
Some information Some information
@ -2456,16 +2455,11 @@ MiscTests.cpp:134:
./failing/info ./failing/info
............................................................................... ...............................................................................
info:
hi
MiscTests.cpp:139:
info:
i := 7
MiscTests.cpp:141:
FAILED: FAILED:
REQUIRE( false ) REQUIRE( false )
with messages:
hi
i := 7
MiscTests.cpp:142: MiscTests.cpp:142:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -2552,12 +2546,10 @@ No assertions in section, 'encoded chars'
./manual/onechar ./manual/onechar
............................................................................... ...............................................................................
info:
3
MiscTests.cpp:195:
FAILED: FAILED:
REQUIRE( false ) REQUIRE( false )
with message:
3
MiscTests.cpp:196: MiscTests.cpp:196:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -4246,7 +4238,7 @@ BDDTests.cpp:29:
96 test cases - 45 failed (610 assertions - 102 failed) 96 test cases - 45 failed (610 assertions - 102 failed)
CatchSelfTest is a CATCH v0.9 b15 (integration) host application. CatchSelfTest is a CATCH v0.9 b16 (integration) host application.
Run with -? for options Run with -? for options
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -4715,7 +4707,7 @@ ExceptionTests.cpp:52
</error> </error>
</testcase> </testcase>
<testcase classname="global" name="./failing/exceptions/implicit/2" time="tbd"> <testcase classname="global" name="./failing/exceptions/implicit/2" time="tbd">
<error message="{Unknown expression after this line}"> <error message="{Unknown expression after the reported line}">
ExceptionTests.cpp:60 ExceptionTests.cpp:60
</error> </error>
</testcase> </testcase>
@ -4750,29 +4742,14 @@ MessageTests.cpp:14
</testcase> </testcase>
<testcase classname="global" name="./succeeding/succeed" time="tbd"/> <testcase classname="global" name="./succeeding/succeed" time="tbd"/>
<testcase classname="global" name="./failing/message/info/1" time="tbd"> <testcase classname="global" name="./failing/message/info/1" time="tbd">
<info type="INFO">
MessageTests.cpp:23
</info>
<info type="INFO">
MessageTests.cpp:24
</info>
<failure message="2 == 1" type="REQUIRE"> <failure message="2 == 1" type="REQUIRE">
MessageTests.cpp:26 MessageTests.cpp:26
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./mixed/message/info/2" time="tbd"> <testcase classname="global" name="./mixed/message/info/2" time="tbd">
<info type="INFO">
MessageTests.cpp:31
</info>
<info type="INFO">
MessageTests.cpp:35
</info>
<failure message="2 == 1" type="CHECK"> <failure message="2 == 1" type="CHECK">
MessageTests.cpp:37 MessageTests.cpp:37
</failure> </failure>
<info type="INFO">
MessageTests.cpp:39
</info>
<failure message="2 == 0" type="CHECK"> <failure message="2 == 0" type="CHECK">
MessageTests.cpp:41 MessageTests.cpp:41
</failure> </failure>
@ -4797,12 +4774,6 @@ Message from section two
</system-out> </system-out>
</testcase> </testcase>
<testcase classname="global" name="./mixed/message/scoped" time="tbd"> <testcase classname="global" name="./mixed/message/scoped" time="tbd">
<info message="i &lt; 10" type="REQUIRE">
MessageTests.cpp:86
</info>
<info message="i &lt; 10" type="REQUIRE">
MessageTests.cpp:86
</info>
<failure message="10 &lt; 10" type="REQUIRE"> <failure message="10 &lt; 10" type="REQUIRE">
MessageTests.cpp:86 MessageTests.cpp:86
</failure> </failure>
@ -4826,45 +4797,21 @@ MiscTests.cpp:103
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./mixed/Misc/loops" time="tbd"> <testcase classname="global" name="./mixed/Misc/loops" time="tbd">
<info type="INFO">
MiscTests.cpp:114
</info>
<failure message="1 == 0" type="CHECK"> <failure message="1 == 0" type="CHECK">
MiscTests.cpp:115 MiscTests.cpp:115
</failure> </failure>
<info type="INFO">
MiscTests.cpp:114
</info>
<failure message="1 == 0" type="CHECK"> <failure message="1 == 0" type="CHECK">
MiscTests.cpp:115 MiscTests.cpp:115
</failure> </failure>
<info type="INFO">
MiscTests.cpp:114
</info>
<info type="INFO">
MiscTests.cpp:114
</info>
<failure message="1 == 0" type="CHECK"> <failure message="1 == 0" type="CHECK">
MiscTests.cpp:115 MiscTests.cpp:115
</failure> </failure>
<info type="INFO">
MiscTests.cpp:114
</info>
<failure message="1 == 0" type="CHECK"> <failure message="1 == 0" type="CHECK">
MiscTests.cpp:115 MiscTests.cpp:115
</failure> </failure>
<info type="INFO">
MiscTests.cpp:114
</info>
<info type="INFO">
MiscTests.cpp:114
</info>
<failure message="1 == 0" type="CHECK"> <failure message="1 == 0" type="CHECK">
MiscTests.cpp:115 MiscTests.cpp:115
</failure> </failure>
<info type="INFO">
MiscTests.cpp:114
</info>
<failure message="1 == 0" type="CHECK"> <failure message="1 == 0" type="CHECK">
MiscTests.cpp:115 MiscTests.cpp:115
</failure> </failure>
@ -4879,12 +4826,6 @@ An error
</testcase> </testcase>
<testcase classname="global" name="./succeeding/Misc/null strings" time="tbd"/> <testcase classname="global" name="./succeeding/Misc/null strings" time="tbd"/>
<testcase classname="global" name="./failing/info" time="tbd"> <testcase classname="global" name="./failing/info" time="tbd">
<info type="INFO">
MiscTests.cpp:139
</info>
<info type="CAPTURE">
MiscTests.cpp:141
</info>
<failure message="false" type="REQUIRE"> <failure message="false" type="REQUIRE">
MiscTests.cpp:142 MiscTests.cpp:142
</failure> </failure>
@ -4909,9 +4850,6 @@ MiscTests.cpp:178
</testcase> </testcase>
<testcase classname="global" name="./misc/xmlentitycheck" time="tbd"/> <testcase classname="global" name="./misc/xmlentitycheck" time="tbd"/>
<testcase classname="global" name="./manual/onechar" time="tbd"> <testcase classname="global" name="./manual/onechar" time="tbd">
<info type="INFO">
MiscTests.cpp:195
</info>
<failure message="false" type="REQUIRE"> <failure message="false" type="REQUIRE">
MiscTests.cpp:196 MiscTests.cpp:196
</failure> </failure>
@ -6403,10 +6341,10 @@ ExceptionTests.cpp" line="60">
</Expression> </Expression>
ExceptionTests.cpp" line="60"> ExceptionTests.cpp" line="60">
<Original> <Original>
{Unknown expression after this line} {Unknown expression after the reported line}
</Original> </Original>
<Expanded> <Expanded>
{Unknown expression after this line} {Unknown expression after the reported line}
</Expanded> </Expanded>
ExceptionTests.cpp" line="60"> ExceptionTests.cpp" line="60">
unexpected exception unexpected exception
@ -7652,12 +7590,6 @@ GeneratorTests.cpp" line="40">
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/message/info/1"> <TestCase name="./failing/message/info/1">
<Info>
this message should be logged
</Info>
<Info>
so should this
</Info>
MessageTests.cpp" line="26"> MessageTests.cpp" line="26">
<Original> <Original>
a == 1 a == 1
@ -7677,12 +7609,6 @@ MessageTests.cpp" line="33">
2 == 2 2 == 2
</Expanded> </Expanded>
</Expression> </Expression>
<Info>
this message should be logged
</Info>
<Info>
this message should be logged, too
</Info>
MessageTests.cpp" line="37"> MessageTests.cpp" line="37">
<Original> <Original>
a == 1 a == 1
@ -7691,9 +7617,6 @@ MessageTests.cpp" line="37">
2 == 1 2 == 1
</Expanded> </Expanded>
</Expression> </Expression>
<Info>
and this, but later
</Info>
MessageTests.cpp" line="41"> MessageTests.cpp" line="41">
<Original> <Original>
a == 0 a == 0
@ -7823,28 +7746,6 @@ MessageTests.cpp" line="86">
9 &lt; 10 9 &lt; 10
</Expanded> </Expanded>
</Expression> </Expression>
MessageTests.cpp" line="86">
<Original>
i &lt; 10
</Original>
<Expanded>
i &lt; 10
</Expanded>
<Info>
current counter 10
</Info>
</Expression>
MessageTests.cpp" line="86">
<Original>
i &lt; 10
</Original>
<Expanded>
i &lt; 10
</Expanded>
<Info>
i := 10
</Info>
</Expression>
MessageTests.cpp" line="86"> MessageTests.cpp" line="86">
<Original> <Original>
i &lt; 10 i &lt; 10
@ -8013,9 +7914,6 @@ MiscTests.cpp" line="103">
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./mixed/Misc/loops"> <TestCase name="./mixed/Misc/loops">
<Info>
Testing if fib[0] (1) is even
</Info>
MiscTests.cpp" line="115"> MiscTests.cpp" line="115">
<Original> <Original>
( fib[i] % 2 ) == 0 ( fib[i] % 2 ) == 0
@ -8024,9 +7922,6 @@ MiscTests.cpp" line="115">
1 == 0 1 == 0
</Expanded> </Expanded>
</Expression> </Expression>
<Info>
Testing if fib[1] (1) is even
</Info>
MiscTests.cpp" line="115"> MiscTests.cpp" line="115">
<Original> <Original>
( fib[i] % 2 ) == 0 ( fib[i] % 2 ) == 0
@ -8043,12 +7938,6 @@ MiscTests.cpp" line="115">
0 == 0 0 == 0
</Expanded> </Expanded>
</Expression> </Expression>
<Info>
Testing if fib[2] (2) is even
</Info>
<Info>
Testing if fib[3] (3) is even
</Info>
MiscTests.cpp" line="115"> MiscTests.cpp" line="115">
<Original> <Original>
( fib[i] % 2 ) == 0 ( fib[i] % 2 ) == 0
@ -8057,9 +7946,6 @@ MiscTests.cpp" line="115">
1 == 0 1 == 0
</Expanded> </Expanded>
</Expression> </Expression>
<Info>
Testing if fib[4] (5) is even
</Info>
MiscTests.cpp" line="115"> MiscTests.cpp" line="115">
<Original> <Original>
( fib[i] % 2 ) == 0 ( fib[i] % 2 ) == 0
@ -8076,12 +7962,6 @@ MiscTests.cpp" line="115">
0 == 0 0 == 0
</Expanded> </Expanded>
</Expression> </Expression>
<Info>
Testing if fib[5] (8) is even
</Info>
<Info>
Testing if fib[6] (13) is even
</Info>
MiscTests.cpp" line="115"> MiscTests.cpp" line="115">
<Original> <Original>
( fib[i] % 2 ) == 0 ( fib[i] % 2 ) == 0
@ -8090,9 +7970,6 @@ MiscTests.cpp" line="115">
1 == 0 1 == 0
</Expanded> </Expanded>
</Expression> </Expression>
<Info>
Testing if fib[7] (21) is even
</Info>
MiscTests.cpp" line="115"> MiscTests.cpp" line="115">
<Original> <Original>
( fib[i] % 2 ) == 0 ( fib[i] % 2 ) == 0
@ -8126,12 +8003,6 @@ MiscTests.cpp" line="134">
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/info"> <TestCase name="./failing/info">
<Info>
hi
</Info>
<Info>
i := 7
</Info>
MiscTests.cpp" line="142"> MiscTests.cpp" line="142">
<Original> <Original>
false false
@ -8228,9 +8099,6 @@ MiscTests.cpp" line="178">
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./manual/onechar"> <TestCase name="./manual/onechar">
<Info>
3
</Info>
MiscTests.cpp" line="196"> MiscTests.cpp" line="196">
<Original> <Original>
false false
@ -10136,7 +10004,7 @@ ExceptionTests.cpp:52: Unexpected exception with message: 'unexpected exception'
[Running: ./failing/exceptions/implicit/2] [Running: ./failing/exceptions/implicit/2]
ExceptionTests.cpp:60: 1 == 1 succeeded ExceptionTests.cpp:60: 1 == 1 succeeded
ExceptionTests.cpp:60: {Unknown expression after this line} failed with unexpected exception with message: 'unexpected exception' ExceptionTests.cpp:60: {Unknown expression after the reported line} failed with unexpected exception with message: 'unexpected exception'
[Finished: './failing/exceptions/implicit/2' 1 test case failed (1 of 2 assertions failed)] [Finished: './failing/exceptions/implicit/2' 1 test case failed (1 of 2 assertions failed)]
[Running: ./succeeding/exceptions/implicit] [Running: ./succeeding/exceptions/implicit]
@ -10330,17 +10198,12 @@ MessageTests.cpp:18: succeeded
[Finished: './succeeding/succeed' All tests passed (1 assertion in 1 test case)] [Finished: './succeeding/succeed' All tests passed (1 assertion in 1 test case)]
[Running: ./failing/message/info/1] [Running: ./failing/message/info/1]
MessageTests.cpp:23: [info: this message should be logged]
MessageTests.cpp:24: [info: so should this]
MessageTests.cpp:26: a == 1 failed for: 2 == 1 MessageTests.cpp:26: a == 1 failed for: 2 == 1
[Finished: './failing/message/info/1' 1 test case failed (1 assertion failed)] [Finished: './failing/message/info/1' 1 test case failed (1 assertion failed)]
[Running: ./mixed/message/info/2] [Running: ./mixed/message/info/2]
MessageTests.cpp:33: a == 2 succeeded for: 2 == 2 MessageTests.cpp:33: a == 2 succeeded for: 2 == 2
MessageTests.cpp:31: [info: this message should be logged]
MessageTests.cpp:35: [info: this message should be logged, too]
MessageTests.cpp:37: a == 1 failed for: 2 == 1 MessageTests.cpp:37: a == 1 failed for: 2 == 1
MessageTests.cpp:39: [info: and this, but later]
MessageTests.cpp:41: a == 0 failed for: 2 == 0 MessageTests.cpp:41: a == 0 failed for: 2 == 0
MessageTests.cpp:45: a == 2 succeeded for: 2 == 2 MessageTests.cpp:45: a == 2 succeeded for: 2 == 2
[Finished: './mixed/message/info/2' 1 test case failed (2 of 4 assertions failed)] [Finished: './mixed/message/info/2' 1 test case failed (2 of 4 assertions failed)]
@ -10389,8 +10252,6 @@ MessageTests.cpp:86: i < 10 succeeded for: 6 < 10
MessageTests.cpp:86: i < 10 succeeded for: 7 < 10 MessageTests.cpp:86: i < 10 succeeded for: 7 < 10
MessageTests.cpp:86: i < 10 succeeded for: 8 < 10 MessageTests.cpp:86: i < 10 succeeded for: 8 < 10
MessageTests.cpp:86: i < 10 succeeded for: 9 < 10 MessageTests.cpp:86: i < 10 succeeded for: 9 < 10
MessageTests.cpp:86: i < 10 succeeded[info: current counter 10]
MessageTests.cpp:86: i < 10 succeeded[info: i := 10]
MessageTests.cpp:86: i < 10 failed for: 10 < 10 MessageTests.cpp:86: i < 10 failed for: 10 < 10
[Finished: './mixed/message/scoped' 1 test case failed (1 of 11 assertions failed)] [Finished: './mixed/message/scoped' 1 test case failed (1 of 11 assertions failed)]
@ -10484,21 +10345,13 @@ MiscTests.cpp:103: b > a failed for: 0 > 1
[Finished: './mixed/Misc/Sections/loops' 1 test case failed (1 assertion failed)] [Finished: './mixed/Misc/Sections/loops' 1 test case failed (1 assertion failed)]
[Running: ./mixed/Misc/loops] [Running: ./mixed/Misc/loops]
MiscTests.cpp:114: [info: Testing if fib[0] (1) is even]
MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0 MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0
MiscTests.cpp:114: [info: Testing if fib[1] (1) is even]
MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0 MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0
MiscTests.cpp:115: ( fib[i] % 2 ) == 0 succeeded for: 0 == 0 MiscTests.cpp:115: ( fib[i] % 2 ) == 0 succeeded for: 0 == 0
MiscTests.cpp:114: [info: Testing if fib[2] (2) is even]
MiscTests.cpp:114: [info: Testing if fib[3] (3) is even]
MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0 MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0
MiscTests.cpp:114: [info: Testing if fib[4] (5) is even]
MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0 MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0
MiscTests.cpp:115: ( fib[i] % 2 ) == 0 succeeded for: 0 == 0 MiscTests.cpp:115: ( fib[i] % 2 ) == 0 succeeded for: 0 == 0
MiscTests.cpp:114: [info: Testing if fib[5] (8) is even]
MiscTests.cpp:114: [info: Testing if fib[6] (13) is even]
MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0 MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0
MiscTests.cpp:114: [info: Testing if fib[7] (21) is even]
MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0 MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0
[Finished: './mixed/Misc/loops' 1 test case failed (6 of 8 assertions failed)] [Finished: './mixed/Misc/loops' 1 test case failed (6 of 8 assertions failed)]
Some information Some information
@ -10516,8 +10369,6 @@ MiscTests.cpp:134: makeString( true ) == static_cast<char*>(__null) succeeded fo
[Finished: './succeeding/Misc/null strings' All tests passed (2 assertions in 1 test case)] [Finished: './succeeding/Misc/null strings' All tests passed (2 assertions in 1 test case)]
[Running: ./failing/info] [Running: ./failing/info]
MiscTests.cpp:139: [info: hi]
MiscTests.cpp:141: [info: i := 7]
MiscTests.cpp:142: false failed MiscTests.cpp:142: false failed
[Finished: './failing/info' 1 test case failed (1 assertion failed)] [Finished: './failing/info' 1 test case failed (1 assertion failed)]
@ -10557,7 +10408,6 @@ No assertions in section, 'encoded chars'
[Finished: './misc/xmlentitycheck' 1 test case failed (All 2 assertions failed)] [Finished: './misc/xmlentitycheck' 1 test case failed (All 2 assertions failed)]
[Running: ./manual/onechar] [Running: ./manual/onechar]
MiscTests.cpp:195: [info: 3]
MiscTests.cpp:196: false failed MiscTests.cpp:196: false failed
[Finished: './manual/onechar' 1 test case failed (1 assertion failed)] [Finished: './manual/onechar' 1 test case failed (1 assertion failed)]

View File

@ -0,0 +1,2 @@
// This file is only here to verify (to the extent possible) the self sufficiency of the header
#include "catch_message.h"

View File

@ -115,7 +115,7 @@ namespace Catch {
} }
break; break;
} }
}; }
private: private:
Expected::Result m_expectedResult; Expected::Result m_expectedResult;

View File

@ -7,6 +7,7 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26847E5D16BBADB40043B9C1 /* catch_message.cpp */; };
2694A1FD16A0000E004816E3 /* catch_line_wrap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2694A1FB16A0000E004816E3 /* catch_line_wrap.cpp */; }; 2694A1FD16A0000E004816E3 /* catch_line_wrap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2694A1FB16A0000E004816E3 /* catch_line_wrap.cpp */; };
4A45DA2416161EF9004F8D6B /* catch_console_colour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2316161EF9004F8D6B /* catch_console_colour.cpp */; }; 4A45DA2416161EF9004F8D6B /* catch_console_colour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2316161EF9004F8D6B /* catch_console_colour.cpp */; };
4A45DA2716161F1F004F8D6B /* catch_ptr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2616161F1F004F8D6B /* catch_ptr.cpp */; }; 4A45DA2716161F1F004F8D6B /* catch_ptr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2616161F1F004F8D6B /* catch_ptr.cpp */; };
@ -53,6 +54,9 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
26847E5B16BBAB790043B9C1 /* catch_message.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_message.h; sourceTree = "<group>"; };
26847E5C16BBACB60043B9C1 /* catch_message.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_message.hpp; sourceTree = "<group>"; };
26847E5D16BBADB40043B9C1 /* catch_message.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_message.cpp; path = ../../../SelfTest/SurrogateCpps/catch_message.cpp; sourceTree = "<group>"; };
2694A1F8169FFF9B004816E3 /* catch_line_wrap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_line_wrap.h; sourceTree = "<group>"; }; 2694A1F8169FFF9B004816E3 /* catch_line_wrap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_line_wrap.h; sourceTree = "<group>"; };
2694A1FA169FFFEC004816E3 /* catch_line_wrap.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_line_wrap.hpp; sourceTree = "<group>"; }; 2694A1FA169FFFEC004816E3 /* catch_line_wrap.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_line_wrap.hpp; sourceTree = "<group>"; };
2694A1FB16A0000E004816E3 /* catch_line_wrap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = catch_line_wrap.cpp; sourceTree = "<group>"; }; 2694A1FB16A0000E004816E3 /* catch_line_wrap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = catch_line_wrap.cpp; sourceTree = "<group>"; };
@ -275,6 +279,7 @@
4AB3D9A1161621B500C9A0F8 /* catch_interfaces_generators.cpp */, 4AB3D9A1161621B500C9A0F8 /* catch_interfaces_generators.cpp */,
4ACE21CA166CA1B300FB5509 /* catch_option.cpp */, 4ACE21CA166CA1B300FB5509 /* catch_option.cpp */,
2694A1FB16A0000E004816E3 /* catch_line_wrap.cpp */, 2694A1FB16A0000E004816E3 /* catch_line_wrap.cpp */,
26847E5D16BBADB40043B9C1 /* catch_message.cpp */,
); );
name = SurrogateCpps; name = SurrogateCpps;
sourceTree = "<group>"; sourceTree = "<group>";
@ -294,6 +299,7 @@
4A90B59E15D2521E00EF71BC /* catch_expressionresult_builder.hpp */, 4A90B59E15D2521E00EF71BC /* catch_expressionresult_builder.hpp */,
4A084F1C15DACEEA0027E631 /* catch_test_case_info.hpp */, 4A084F1C15DACEEA0027E631 /* catch_test_case_info.hpp */,
2694A1FA169FFFEC004816E3 /* catch_line_wrap.hpp */, 2694A1FA169FFFEC004816E3 /* catch_line_wrap.hpp */,
26847E5C16BBACB60043B9C1 /* catch_message.hpp */,
); );
name = impl; name = impl;
sourceTree = "<group>"; sourceTree = "<group>";
@ -314,6 +320,7 @@
4AC91CCE155CF02800DC5117 /* catch_expression_lhs.hpp */, 4AC91CCE155CF02800DC5117 /* catch_expression_lhs.hpp */,
4AC91CD0155D8DA600DC5117 /* catch_expression_decomposer.hpp */, 4AC91CD0155D8DA600DC5117 /* catch_expression_decomposer.hpp */,
4A4B0F9A15CEF84800AE2392 /* catch_notimplemented_exception.h */, 4A4B0F9A15CEF84800AE2392 /* catch_notimplemented_exception.h */,
26847E5B16BBAB790043B9C1 /* catch_message.h */,
); );
name = Assertions; name = Assertions;
sourceTree = "<group>"; sourceTree = "<group>";
@ -473,6 +480,7 @@
4AB3D9A2161621B500C9A0F8 /* catch_interfaces_generators.cpp in Sources */, 4AB3D9A2161621B500C9A0F8 /* catch_interfaces_generators.cpp in Sources */,
4ACE21CC166CA1B300FB5509 /* catch_option.cpp in Sources */, 4ACE21CC166CA1B300FB5509 /* catch_option.cpp in Sources */,
2694A1FD16A0000E004816E3 /* catch_line_wrap.cpp in Sources */, 2694A1FD16A0000E004816E3 /* catch_line_wrap.cpp in Sources */,
26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };