fixed merge

This commit is contained in:
Phil Nash 2010-11-29 22:33:48 +00:00
commit fa9f970890
13 changed files with 564 additions and 33 deletions

31
Test/MiscTests.cpp Normal file
View File

@ -0,0 +1,31 @@
/*
* MiscTests.cpp
* Catch - Test
*
* Created by Phil on 29/11/2010.
* Copyright 2010 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)
*
*/
#include "../catch.hpp"
TEST_CASE( "succeeding/Misc/Sections", "random SECTION tests" )
{
int a = 1;
int b = 2;
SECTION( "s1", "doesn't equal" )
{
EXPECT( a != b );
EXPECT( b != a );
}
SECTION( "s2", "not equal" )
{
EXPECT_NOT( a == b);
}
}

View File

@ -0,0 +1,293 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
4A3BFFB9128DCF06005609E3 /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A3BFFB8128DCF06005609E3 /* TestMain.cpp */; };
4AA7EA9212A438C7005A0B97 /* MiscTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AA7EA9112A438C7005A0B97 /* MiscTests.cpp */; };
4AFC38CD12887D80003A0C29 /* ConditionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC38CC12887D80003A0C29 /* ConditionTests.cpp */; };
4AFC3A9912893C56003A0C29 /* ExceptionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC3A9812893C56003A0C29 /* ExceptionTests.cpp */; };
4AFC3AA912893E54003A0C29 /* MessageTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC3AA812893E54003A0C29 /* MessageTests.cpp */; };
4AFC3B0B12894114003A0C29 /* ClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC3B0A12894114003A0C29 /* ClassTests.cpp */; };
4AFC3B671289C7E3003A0C29 /* TrickyTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC3B661289C7E3003A0C29 /* TrickyTests.cpp */; };
8DD76F6A0486A84900D96B5E /* Test.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* Test.1 */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
8DD76F690486A84900D96B5E /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 8;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
8DD76F6A0486A84900D96B5E /* Test.1 in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
4A3BFFB8128DCF06005609E3 /* TestMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestMain.cpp; sourceTree = "<group>"; };
4A3BFFF0128DD23C005609E3 /* catch_runnerconfig.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_runnerconfig.hpp; path = ../internal/catch_runnerconfig.hpp; sourceTree = SOURCE_ROOT; };
4AA7E968129FA1DF005A0B97 /* catch_reporter_junit.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_reporter_junit.hpp; path = ../../../Lib/Catch/catch_reporter_junit.hpp; sourceTree = SOURCE_ROOT; };
4AA7EA9112A438C7005A0B97 /* MiscTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MiscTests.cpp; sourceTree = "<group>"; };
4AFC341512809A36003A0C29 /* catch_capture.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_capture.hpp; path = ../internal/catch_capture.hpp; sourceTree = SOURCE_ROOT; };
4AFC341612809A36003A0C29 /* catch_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = catch_common.h; path = ../internal/catch_common.h; sourceTree = SOURCE_ROOT; };
4AFC341712809A36003A0C29 /* catch_registry.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_registry.hpp; path = ../internal/catch_registry.hpp; sourceTree = SOURCE_ROOT; };
4AFC341812809A36003A0C29 /* catch_reporter_registry.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_reporter_registry.hpp; path = ../internal/catch_reporter_registry.hpp; sourceTree = SOURCE_ROOT; };
4AFC341912809A36003A0C29 /* catch_resultinfo.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_resultinfo.hpp; path = ../internal/catch_resultinfo.hpp; sourceTree = SOURCE_ROOT; };
4AFC341A12809A36003A0C29 /* catch_runner_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_runner_impl.hpp; path = ../internal/catch_runner_impl.hpp; sourceTree = SOURCE_ROOT; };
4AFC341B12809A36003A0C29 /* catch_testcaseinfo.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_testcaseinfo.hpp; path = ../internal/catch_testcaseinfo.hpp; sourceTree = SOURCE_ROOT; };
4AFC341C12809A45003A0C29 /* catch_default_main.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_default_main.hpp; path = ../catch_default_main.hpp; sourceTree = SOURCE_ROOT; };
4AFC341D12809A45003A0C29 /* catch_reporter_basic.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_reporter_basic.hpp; path = ../catch_reporter_basic.hpp; sourceTree = SOURCE_ROOT; };
4AFC341E12809A45003A0C29 /* catch_reporter_xml.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_reporter_xml.hpp; path = ../catch_reporter_xml.hpp; sourceTree = SOURCE_ROOT; };
4AFC341F12809A45003A0C29 /* catch_list.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_list.hpp; path = ../internal/catch_list.hpp; sourceTree = SOURCE_ROOT; };
4AFC342012809A45003A0C29 /* catch.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch.hpp; path = ../catch.hpp; sourceTree = SOURCE_ROOT; };
4AFC346412809D41003A0C29 /* catch_commandline.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_commandline.hpp; path = ../internal/catch_commandline.hpp; sourceTree = SOURCE_ROOT; };
4AFC359B1281F00B003A0C29 /* catch_section.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_section.hpp; path = ../internal/catch_section.hpp; sourceTree = SOURCE_ROOT; };
4AFC38161284B387003A0C29 /* catch_runner.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_runner.hpp; path = ../catch_runner.hpp; sourceTree = SOURCE_ROOT; };
4AFC38CC12887D80003A0C29 /* ConditionTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConditionTests.cpp; sourceTree = "<group>"; };
4AFC3A9812893C56003A0C29 /* ExceptionTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExceptionTests.cpp; sourceTree = "<group>"; };
4AFC3AA812893E54003A0C29 /* MessageTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MessageTests.cpp; sourceTree = "<group>"; };
4AFC3B0A12894114003A0C29 /* ClassTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassTests.cpp; sourceTree = "<group>"; };
4AFC3B661289C7E3003A0C29 /* TrickyTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrickyTests.cpp; sourceTree = "<group>"; };
8DD76F6C0486A84900D96B5E /* Test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Test; sourceTree = BUILT_PRODUCTS_DIR; };
C6859E8B029090EE04C91782 /* Test.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = Test.1; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8DD76F660486A84900D96B5E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
08FB7794FE84155DC02AAC07 /* Test */ = {
isa = PBXGroup;
children = (
08FB7795FE84155DC02AAC07 /* Source */,
C6859E8C029090F304C91782 /* Documentation */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
name = Test;
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
4AA7E96C129FA2A0005A0B97 /* Tests */,
4A3BFFB8128DCF06005609E3 /* TestMain.cpp */,
4AFC341312809A12003A0C29 /* Catch */,
);
name = Source;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8DD76F6C0486A84900D96B5E /* Test */,
);
name = Products;
sourceTree = "<group>";
};
4AA7E96B129FA282005A0B97 /* Reporters */ = {
isa = PBXGroup;
children = (
4AFC341D12809A45003A0C29 /* catch_reporter_basic.hpp */,
4AFC341E12809A45003A0C29 /* catch_reporter_xml.hpp */,
4AA7E968129FA1DF005A0B97 /* catch_reporter_junit.hpp */,
);
name = Reporters;
sourceTree = "<group>";
};
4AA7E96C129FA2A0005A0B97 /* Tests */ = {
isa = PBXGroup;
children = (
4AA7EA9112A438C7005A0B97 /* MiscTests.cpp */,
4AFC38CC12887D80003A0C29 /* ConditionTests.cpp */,
4AFC3A9812893C56003A0C29 /* ExceptionTests.cpp */,
4AFC3AA812893E54003A0C29 /* MessageTests.cpp */,
4AFC3B0A12894114003A0C29 /* ClassTests.cpp */,
4AFC3B661289C7E3003A0C29 /* TrickyTests.cpp */,
);
name = Tests;
sourceTree = "<group>";
};
4AFC341312809A12003A0C29 /* Catch */ = {
isa = PBXGroup;
children = (
4AFC342012809A45003A0C29 /* catch.hpp */,
4AFC341C12809A45003A0C29 /* catch_default_main.hpp */,
4AFC38161284B387003A0C29 /* catch_runner.hpp */,
4AA7E96B129FA282005A0B97 /* Reporters */,
4AFC341412809A1B003A0C29 /* Internal */,
);
name = Catch;
sourceTree = "<group>";
};
4AFC341412809A1B003A0C29 /* Internal */ = {
isa = PBXGroup;
children = (
4A3BFFF0128DD23C005609E3 /* catch_runnerconfig.hpp */,
4AFC341F12809A45003A0C29 /* catch_list.hpp */,
4AFC359B1281F00B003A0C29 /* catch_section.hpp */,
4AFC346412809D41003A0C29 /* catch_commandline.hpp */,
4AFC341512809A36003A0C29 /* catch_capture.hpp */,
4AFC341612809A36003A0C29 /* catch_common.h */,
4AFC341712809A36003A0C29 /* catch_registry.hpp */,
4AFC341812809A36003A0C29 /* catch_reporter_registry.hpp */,
4AFC341912809A36003A0C29 /* catch_resultinfo.hpp */,
4AFC341A12809A36003A0C29 /* catch_runner_impl.hpp */,
4AFC341B12809A36003A0C29 /* catch_testcaseinfo.hpp */,
);
name = Internal;
sourceTree = "<group>";
};
C6859E8C029090F304C91782 /* Documentation */ = {
isa = PBXGroup;
children = (
C6859E8B029090EE04C91782 /* Test.1 */,
);
name = Documentation;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8DD76F620486A84900D96B5E /* Test */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "Test" */;
buildPhases = (
8DD76F640486A84900D96B5E /* Sources */,
8DD76F660486A84900D96B5E /* Frameworks */,
8DD76F690486A84900D96B5E /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = Test;
productInstallPath = "$(HOME)/bin";
productName = Test;
productReference = 8DD76F6C0486A84900D96B5E /* Test */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "Test" */;
compatibilityVersion = "Xcode 3.1";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* Test */;
projectDirPath = "";
projectRoot = "";
targets = (
8DD76F620486A84900D96B5E /* Test */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
8DD76F640486A84900D96B5E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4AFC38CD12887D80003A0C29 /* ConditionTests.cpp in Sources */,
4AFC3A9912893C56003A0C29 /* ExceptionTests.cpp in Sources */,
4AFC3AA912893E54003A0C29 /* MessageTests.cpp in Sources */,
4AFC3B0B12894114003A0C29 /* ClassTests.cpp in Sources */,
4AFC3B671289C7E3003A0C29 /* TrickyTests.cpp in Sources */,
4A3BFFB9128DCF06005609E3 /* TestMain.cpp in Sources */,
4AA7EA9212A438C7005A0B97 /* MiscTests.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
1DEB923208733DC60010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = Test;
};
name = Debug;
};
1DEB923308733DC60010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = Test;
};
name = Release;
};
1DEB923608733DC60010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = macosx10.6;
};
name = Debug;
};
1DEB923708733DC60010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = macosx10.6;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "Test" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB923208733DC60010E9CD /* Debug */,
1DEB923308733DC60010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "Test" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB923608733DC60010E9CD /* Debug */,
1DEB923708733DC60010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
}

View File

@ -14,6 +14,7 @@
#include "../catch_runner.hpp" #include "../catch_runner.hpp"
// This code runs the meta tests and verifies that the failing ones failed and the successful ones succeeded // This code runs the meta tests and verifies that the failing ones failed and the successful ones succeeded
/*
int main (int argc, char * const argv[]) int main (int argc, char * const argv[])
{ {
using namespace Catch; using namespace Catch;
@ -22,17 +23,18 @@ int main (int argc, char * const argv[])
if( argc > 1 && ( std::string( argv[1] ) == "-s" || std::string( argv[1] ) == "--success" ) ) if( argc > 1 && ( std::string( argv[1] ) == "-s" || std::string( argv[1] ) == "--success" ) )
showAllResults = true; showAllResults = true;
std::ostringstream ossSucceeding;
std::ostringstream ossFailing;
ReporterConfig reporterConfig( ReporterConfig::Include::SuccessfulResults ); ReporterConfig reporterConfig( ReporterConfig::Include::SuccessfulResults );
BasicReporter reporter (reporterConfig ); BasicReporter reporter (reporterConfig );
Runner runner;
runner.setReporter( &reporter );
std::ostringstream ossSucceeding; Runner runner( &reporter );
reporterConfig.setStreamBuf( ossSucceeding.rdbuf() ); reporterConfig.setStreamBuf( ossSucceeding.rdbuf() );
runner.runMatching( "succeeding/*" ); runner.runMatching( "succeeding/*" );
std::string succeedingResults = ossSucceeding.str(); std::string succeedingResults = ossSucceeding.str();
std::ostringstream ossFailing;
reporterConfig.setStreamBuf( ossFailing.rdbuf() ); reporterConfig.setStreamBuf( ossFailing.rdbuf() );
runner.runMatching( "failing/*" ); runner.runMatching( "failing/*" );
std::string failingResults = ossFailing.str(); std::string failingResults = ossFailing.str();
@ -73,3 +75,5 @@ int main (int argc, char * const argv[])
} }
return result; return result;
} }
*/
#include "catch_default_main.hpp"

View File

@ -7,12 +7,22 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
<<<<<<< HEAD:Test/Test.xcodeproj/project.pbxproj
4A3BFFB9128DCF06005609E3 /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A3BFFB8128DCF06005609E3 /* TestMain.cpp */; };
4AA7EA9212A438C7005A0B97 /* MiscTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AA7EA9112A438C7005A0B97 /* MiscTests.cpp */; };
4AFC38CD12887D80003A0C29 /* ConditionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC38CC12887D80003A0C29 /* ConditionTests.cpp */; };
4AFC3A9912893C56003A0C29 /* ExceptionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC3A9812893C56003A0C29 /* ExceptionTests.cpp */; };
4AFC3AA912893E54003A0C29 /* MessageTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC3AA812893E54003A0C29 /* MessageTests.cpp */; };
4AFC3B0B12894114003A0C29 /* ClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC3B0A12894114003A0C29 /* ClassTests.cpp */; };
4AFC3B671289C7E3003A0C29 /* TrickyTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC3B661289C7E3003A0C29 /* TrickyTests.cpp */; };
=======
4A595364128E920B009DC1B9 /* ClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A59535F128E920B009DC1B9 /* ClassTests.cpp */; }; 4A595364128E920B009DC1B9 /* ClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A59535F128E920B009DC1B9 /* ClassTests.cpp */; };
4A595365128E920B009DC1B9 /* ConditionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A595360128E920B009DC1B9 /* ConditionTests.cpp */; }; 4A595365128E920B009DC1B9 /* ConditionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A595360128E920B009DC1B9 /* ConditionTests.cpp */; };
4A595366128E920B009DC1B9 /* ExceptionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A595361128E920B009DC1B9 /* ExceptionTests.cpp */; }; 4A595366128E920B009DC1B9 /* ExceptionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A595361128E920B009DC1B9 /* ExceptionTests.cpp */; };
4A595367128E920B009DC1B9 /* MessageTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A595362128E920B009DC1B9 /* MessageTests.cpp */; }; 4A595367128E920B009DC1B9 /* MessageTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A595362128E920B009DC1B9 /* MessageTests.cpp */; };
4A595368128E920B009DC1B9 /* TrickyTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A595363128E920B009DC1B9 /* TrickyTests.cpp */; }; 4A595368128E920B009DC1B9 /* TrickyTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A595363128E920B009DC1B9 /* TrickyTests.cpp */; };
4A59537A128E9354009DC1B9 /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A595379128E9354009DC1B9 /* TestMain.cpp */; }; 4A59537A128E9354009DC1B9 /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A595379128E9354009DC1B9 /* TestMain.cpp */; };
>>>>>>> 5f43a43662c8b9feca25aeccc79d1c7db664c9a0:Test/Xcode/Test.xcodeproj/project.pbxproj
8DD76F6A0486A84900D96B5E /* Test.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* Test.1 */; }; 8DD76F6A0486A84900D96B5E /* Test.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* Test.1 */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@ -30,6 +40,32 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
<<<<<<< HEAD:Test/Test.xcodeproj/project.pbxproj
4A3BFFB8128DCF06005609E3 /* TestMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestMain.cpp; sourceTree = "<group>"; };
4A3BFFF0128DD23C005609E3 /* catch_runnerconfig.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_runnerconfig.hpp; path = ../internal/catch_runnerconfig.hpp; sourceTree = SOURCE_ROOT; };
4AA7E968129FA1DF005A0B97 /* catch_reporter_junit.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_reporter_junit.hpp; path = ../../../Lib/Catch/catch_reporter_junit.hpp; sourceTree = SOURCE_ROOT; };
4AA7EA9112A438C7005A0B97 /* MiscTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MiscTests.cpp; sourceTree = "<group>"; };
4AFC341512809A36003A0C29 /* catch_capture.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_capture.hpp; path = ../internal/catch_capture.hpp; sourceTree = SOURCE_ROOT; };
4AFC341612809A36003A0C29 /* catch_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = catch_common.h; path = ../internal/catch_common.h; sourceTree = SOURCE_ROOT; };
4AFC341712809A36003A0C29 /* catch_registry.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_registry.hpp; path = ../internal/catch_registry.hpp; sourceTree = SOURCE_ROOT; };
4AFC341812809A36003A0C29 /* catch_reporter_registry.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_reporter_registry.hpp; path = ../internal/catch_reporter_registry.hpp; sourceTree = SOURCE_ROOT; };
4AFC341912809A36003A0C29 /* catch_resultinfo.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_resultinfo.hpp; path = ../internal/catch_resultinfo.hpp; sourceTree = SOURCE_ROOT; };
4AFC341A12809A36003A0C29 /* catch_runner_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_runner_impl.hpp; path = ../internal/catch_runner_impl.hpp; sourceTree = SOURCE_ROOT; };
4AFC341B12809A36003A0C29 /* catch_testcaseinfo.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_testcaseinfo.hpp; path = ../internal/catch_testcaseinfo.hpp; sourceTree = SOURCE_ROOT; };
4AFC341C12809A45003A0C29 /* catch_default_main.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_default_main.hpp; path = ../catch_default_main.hpp; sourceTree = SOURCE_ROOT; };
4AFC341D12809A45003A0C29 /* catch_reporter_basic.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_reporter_basic.hpp; path = ../catch_reporter_basic.hpp; sourceTree = SOURCE_ROOT; };
4AFC341E12809A45003A0C29 /* catch_reporter_xml.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_reporter_xml.hpp; path = ../catch_reporter_xml.hpp; sourceTree = SOURCE_ROOT; };
4AFC341F12809A45003A0C29 /* catch_list.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_list.hpp; path = ../internal/catch_list.hpp; sourceTree = SOURCE_ROOT; };
4AFC342012809A45003A0C29 /* catch.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch.hpp; path = ../catch.hpp; sourceTree = SOURCE_ROOT; };
4AFC346412809D41003A0C29 /* catch_commandline.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_commandline.hpp; path = ../internal/catch_commandline.hpp; sourceTree = SOURCE_ROOT; };
4AFC359B1281F00B003A0C29 /* catch_section.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_section.hpp; path = ../internal/catch_section.hpp; sourceTree = SOURCE_ROOT; };
4AFC38161284B387003A0C29 /* catch_runner.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_runner.hpp; path = ../catch_runner.hpp; sourceTree = SOURCE_ROOT; };
4AFC38CC12887D80003A0C29 /* ConditionTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConditionTests.cpp; sourceTree = "<group>"; };
4AFC3A9812893C56003A0C29 /* ExceptionTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExceptionTests.cpp; sourceTree = "<group>"; };
4AFC3AA812893E54003A0C29 /* MessageTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MessageTests.cpp; sourceTree = "<group>"; };
4AFC3B0A12894114003A0C29 /* ClassTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassTests.cpp; sourceTree = "<group>"; };
4AFC3B661289C7E3003A0C29 /* TrickyTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrickyTests.cpp; sourceTree = "<group>"; };
=======
4A59535F128E920B009DC1B9 /* ClassTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClassTests.cpp; path = ../ClassTests.cpp; sourceTree = SOURCE_ROOT; }; 4A59535F128E920B009DC1B9 /* ClassTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClassTests.cpp; path = ../ClassTests.cpp; sourceTree = SOURCE_ROOT; };
4A595360128E920B009DC1B9 /* ConditionTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConditionTests.cpp; path = ../ConditionTests.cpp; sourceTree = SOURCE_ROOT; }; 4A595360128E920B009DC1B9 /* ConditionTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConditionTests.cpp; path = ../ConditionTests.cpp; sourceTree = SOURCE_ROOT; };
4A595361128E920B009DC1B9 /* ExceptionTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExceptionTests.cpp; path = ../ExceptionTests.cpp; sourceTree = SOURCE_ROOT; }; 4A595361128E920B009DC1B9 /* ExceptionTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExceptionTests.cpp; path = ../ExceptionTests.cpp; sourceTree = SOURCE_ROOT; };
@ -53,6 +89,7 @@
4A59538D128E93E1009DC1B9 /* catch_section.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_section.hpp; path = ../../internal/catch_section.hpp; sourceTree = SOURCE_ROOT; }; 4A59538D128E93E1009DC1B9 /* catch_section.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_section.hpp; path = ../../internal/catch_section.hpp; sourceTree = SOURCE_ROOT; };
4A59538E128E93E1009DC1B9 /* catch_testcaseinfo.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_testcaseinfo.hpp; path = ../../internal/catch_testcaseinfo.hpp; sourceTree = SOURCE_ROOT; }; 4A59538E128E93E1009DC1B9 /* catch_testcaseinfo.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_testcaseinfo.hpp; path = ../../internal/catch_testcaseinfo.hpp; sourceTree = SOURCE_ROOT; };
4A5955C412909CCC009DC1B9 /* catch_objc.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_objc.hpp; path = ../../catch_objc.hpp; sourceTree = SOURCE_ROOT; }; 4A5955C412909CCC009DC1B9 /* catch_objc.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_objc.hpp; path = ../../catch_objc.hpp; sourceTree = SOURCE_ROOT; };
>>>>>>> 5f43a43662c8b9feca25aeccc79d1c7db664c9a0:Test/Xcode/Test.xcodeproj/project.pbxproj
8DD76F6C0486A84900D96B5E /* Test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Test; sourceTree = BUILT_PRODUCTS_DIR; }; 8DD76F6C0486A84900D96B5E /* Test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Test; sourceTree = BUILT_PRODUCTS_DIR; };
C6859E8B029090EE04C91782 /* Test.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = Test.1; sourceTree = "<group>"; }; C6859E8B029090EE04C91782 /* Test.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = Test.1; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@ -81,8 +118,13 @@
08FB7795FE84155DC02AAC07 /* Source */ = { 08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
<<<<<<< HEAD:Test/Test.xcodeproj/project.pbxproj
4AA7E96C129FA2A0005A0B97 /* Tests */,
4A3BFFB8128DCF06005609E3 /* TestMain.cpp */,
=======
4A595379128E9354009DC1B9 /* TestMain.cpp */, 4A595379128E9354009DC1B9 /* TestMain.cpp */,
4A59535E128E91FA009DC1B9 /* Test Cases */, 4A59535E128E91FA009DC1B9 /* Test Cases */,
>>>>>>> 5f43a43662c8b9feca25aeccc79d1c7db664c9a0:Test/Xcode/Test.xcodeproj/project.pbxproj
4AFC341312809A12003A0C29 /* Catch */, 4AFC341312809A12003A0C29 /* Catch */,
); );
name = Source; name = Source;
@ -96,6 +138,29 @@
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
<<<<<<< HEAD:Test/Test.xcodeproj/project.pbxproj
4AA7E96B129FA282005A0B97 /* Reporters */ = {
isa = PBXGroup;
children = (
4AFC341D12809A45003A0C29 /* catch_reporter_basic.hpp */,
4AFC341E12809A45003A0C29 /* catch_reporter_xml.hpp */,
4AA7E968129FA1DF005A0B97 /* catch_reporter_junit.hpp */,
);
name = Reporters;
sourceTree = "<group>";
};
4AA7E96C129FA2A0005A0B97 /* Tests */ = {
isa = PBXGroup;
children = (
4AA7EA9112A438C7005A0B97 /* MiscTests.cpp */,
4AFC38CC12887D80003A0C29 /* ConditionTests.cpp */,
4AFC3A9812893C56003A0C29 /* ExceptionTests.cpp */,
4AFC3AA812893E54003A0C29 /* MessageTests.cpp */,
4AFC3B0A12894114003A0C29 /* ClassTests.cpp */,
4AFC3B661289C7E3003A0C29 /* TrickyTests.cpp */,
);
name = Tests;
=======
4A59535E128E91FA009DC1B9 /* Test Cases */ = { 4A59535E128E91FA009DC1B9 /* Test Cases */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -106,17 +171,25 @@
4A595363128E920B009DC1B9 /* TrickyTests.cpp */, 4A595363128E920B009DC1B9 /* TrickyTests.cpp */,
); );
name = "Test Cases"; name = "Test Cases";
>>>>>>> 5f43a43662c8b9feca25aeccc79d1c7db664c9a0:Test/Xcode/Test.xcodeproj/project.pbxproj
sourceTree = "<group>"; sourceTree = "<group>";
}; };
4AFC341312809A12003A0C29 /* Catch */ = { 4AFC341312809A12003A0C29 /* Catch */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
<<<<<<< HEAD:Test/Test.xcodeproj/project.pbxproj
4AFC342012809A45003A0C29 /* catch.hpp */,
4AFC341C12809A45003A0C29 /* catch_default_main.hpp */,
4AFC38161284B387003A0C29 /* catch_runner.hpp */,
4AA7E96B129FA282005A0B97 /* Reporters */,
=======
4A5955C412909CCC009DC1B9 /* catch_objc.hpp */, 4A5955C412909CCC009DC1B9 /* catch_objc.hpp */,
4A59537F128E93CA009DC1B9 /* catch_default_main.hpp */, 4A59537F128E93CA009DC1B9 /* catch_default_main.hpp */,
4A595380128E93CA009DC1B9 /* catch_reporter_basic.hpp */, 4A595380128E93CA009DC1B9 /* catch_reporter_basic.hpp */,
4A595381128E93CA009DC1B9 /* catch_reporter_xml.hpp */, 4A595381128E93CA009DC1B9 /* catch_reporter_xml.hpp */,
4A595382128E93CA009DC1B9 /* catch_runner.hpp */, 4A595382128E93CA009DC1B9 /* catch_runner.hpp */,
4A595383128E93CA009DC1B9 /* catch.hpp */, 4A595383128E93CA009DC1B9 /* catch.hpp */,
>>>>>>> 5f43a43662c8b9feca25aeccc79d1c7db664c9a0:Test/Xcode/Test.xcodeproj/project.pbxproj
4AFC341412809A1B003A0C29 /* Internal */, 4AFC341412809A1B003A0C29 /* Internal */,
); );
name = Catch; name = Catch;
@ -191,12 +264,22 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
<<<<<<< HEAD:Test/Test.xcodeproj/project.pbxproj
4AFC38CD12887D80003A0C29 /* ConditionTests.cpp in Sources */,
4AFC3A9912893C56003A0C29 /* ExceptionTests.cpp in Sources */,
4AFC3AA912893E54003A0C29 /* MessageTests.cpp in Sources */,
4AFC3B0B12894114003A0C29 /* ClassTests.cpp in Sources */,
4AFC3B671289C7E3003A0C29 /* TrickyTests.cpp in Sources */,
4A3BFFB9128DCF06005609E3 /* TestMain.cpp in Sources */,
4AA7EA9212A438C7005A0B97 /* MiscTests.cpp in Sources */,
=======
4A595364128E920B009DC1B9 /* ClassTests.cpp in Sources */, 4A595364128E920B009DC1B9 /* ClassTests.cpp in Sources */,
4A595365128E920B009DC1B9 /* ConditionTests.cpp in Sources */, 4A595365128E920B009DC1B9 /* ConditionTests.cpp in Sources */,
4A595366128E920B009DC1B9 /* ExceptionTests.cpp in Sources */, 4A595366128E920B009DC1B9 /* ExceptionTests.cpp in Sources */,
4A595367128E920B009DC1B9 /* MessageTests.cpp in Sources */, 4A595367128E920B009DC1B9 /* MessageTests.cpp in Sources */,
4A595368128E920B009DC1B9 /* TrickyTests.cpp in Sources */, 4A595368128E920B009DC1B9 /* TrickyTests.cpp in Sources */,
4A59537A128E9354009DC1B9 /* TestMain.cpp in Sources */, 4A59537A128E9354009DC1B9 /* TestMain.cpp in Sources */,
>>>>>>> 5f43a43662c8b9feca25aeccc79d1c7db664c9a0:Test/Xcode/Test.xcodeproj/project.pbxproj
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -32,12 +32,80 @@ namespace Catch
return "Reports test results as lines of text"; return "Reports test results as lines of text";
} }
private:
///////////////////////////////////////////////////////////////////////////
void ReportCounts( std::size_t succeeded, std::size_t failed )
{
if( failed + succeeded == 0 )
m_config.stream() << "No tests ran";
else if( failed == 0 )
m_config.stream() << "All " << succeeded << " test(s) succeeded";
else if( succeeded == 0 )
m_config.stream() << "All " << failed << " test(s) failed";
else
m_config.stream() << succeeded << " test(s) passed but " << failed << " test(s) failed";
}
private: // ITestReporter private: // ITestReporter
///////////////////////////////////////////////////////////////////////////
virtual void StartTesting()
{
m_config.stream() << "[Started testing]" << std::endl;
}
///////////////////////////////////////////////////////////////////////////
virtual void EndTesting( std::size_t succeeded, std::size_t failed )
{
m_config.stream() << "[Testing completed. ";
ReportCounts( succeeded, failed );
m_config.stream() << "]" << std::endl;
(succeeded, failed);
}
///////////////////////////////////////////////////////////////////////////
virtual void StartGroup( const std::string& groupName )
{
if( !groupName.empty() )
m_config.stream() << "[Started group: '" << groupName << "']" << std::endl;
}
///////////////////////////////////////////////////////////////////////////
virtual void EndGroup( const std::string& groupName, std::size_t succeeded, std::size_t failed )
{
if( !groupName.empty() )
{
m_config.stream() << "[End of group: '" << groupName << "'. ";
ReportCounts( succeeded, failed );
m_config.stream() << "]\n" << std::endl;
}
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
virtual void StartTestCase( const TestCaseInfo& testInfo ) virtual void StartTestCase( const TestCaseInfo& testInfo )
{ {
m_config.stream() << std::endl << "[Running: " << testInfo.getName() << "]" << std::endl; m_config.stream() << std::endl << "[Running: " << testInfo.getName() << "]" << std::endl;
m_firstSectionInTestCase = true;
}
///////////////////////////////////////////////////////////////////////////
virtual void StartSection( const std::string& sectionName, const std::string /*description*/ )
{
if( m_firstSectionInTestCase )
{
m_config.stream() << "\n";
m_firstSectionInTestCase = false;
}
m_config.stream() << "[Started section: '" << sectionName << "']" << std::endl;
}
///////////////////////////////////////////////////////////////////////////
virtual void EndSection( const std::string& sectionName, std::size_t succeeded, std::size_t failed )
{
m_config.stream() << "[End of section: '" << sectionName << "'. ";
ReportCounts( succeeded, failed );
m_config.stream() << "]\n" << std::endl;
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -92,6 +160,7 @@ namespace Catch
private: private:
const ReporterConfig& m_config; const ReporterConfig& m_config;
bool m_firstSectionInTestCase;
}; };
} // end namespace Catch } // end namespace Catch

View File

@ -35,6 +35,15 @@ namespace Catch
private: // ITestReporter private: // ITestReporter
virtual void StartTesting(){}
virtual void EndTesting( std::size_t succeeded, std::size_t failed ){(succeeded, failed);}
virtual void StartGroup( const std::string& groupName ){(groupName);}
virtual void EndGroup( const std::string& groupName, std::size_t succeeded, std::size_t failed ){(groupName, succeeded, failed);}
virtual void StartSection( const std::string& sectionName, const std::string description ){(sectionName,description);}
virtual void EndSection( const std::string& sectionName, std::size_t succeeded, std::size_t failed ){(sectionName, succeeded, failed);}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo ) virtual void StartTestCase( const Catch::TestCaseInfo& testInfo )
{ {

View File

@ -17,6 +17,7 @@
#include "internal/catch_list.hpp" #include "internal/catch_list.hpp"
#include "catch_reporter_basic.hpp" #include "catch_reporter_basic.hpp"
#include "catch_reporter_xml.hpp" #include "catch_reporter_xml.hpp"
#include "catch_reporter_junit.hpp"
namespace Catch namespace Catch
{ {
@ -24,6 +25,7 @@ namespace Catch
{ {
ReporterRegistry::instance().registerReporter<BasicReporter>( "basic" ); ReporterRegistry::instance().registerReporter<BasicReporter>( "basic" );
ReporterRegistry::instance().registerReporter<XmlReporter>( "xml" ); ReporterRegistry::instance().registerReporter<XmlReporter>( "xml" );
ReporterRegistry::instance().registerReporter<JunitReporter>( "junit" );
RunnerConfig config; RunnerConfig config;
ArgParser( argc, argv, config ); ArgParser( argc, argv, config );
@ -51,13 +53,14 @@ namespace Catch
config.getReporterConfig().setStreamBuf( ofs.rdbuf() ); config.getReporterConfig().setStreamBuf( ofs.rdbuf() );
} }
Runner runner; Runner runner( config.getReporter() );
runner.setReporter( config.getReporter() );
// Run test specs specified on the command line - or default to all // Run test specs specified on the command line - or default to all
if( config.m_testSpecs.size() == 0 ) if( config.m_testSpecs.size() == 0 )
{ {
config.getReporter()->StartGroup( "" );
runner.runAll(); runner.runAll();
config.getReporter()->EndGroup( "", runner.getSuccessCount(), runner.getFailureCount() );
} }
else else
{ {
@ -67,11 +70,15 @@ namespace Catch
std::vector<std::string>::const_iterator itEnd = config.m_testSpecs.end(); std::vector<std::string>::const_iterator itEnd = config.m_testSpecs.end();
for(; it != itEnd; ++it ) for(; it != itEnd; ++it )
{ {
size_t prevSuccess = runner.getSuccessCount();
size_t prevFail = runner.getFailureCount();
config.getReporter()->StartGroup( *it );
if( runner.runMatching( *it ) == 0 ) if( runner.runMatching( *it ) == 0 )
{ {
// Use reporter? // Use reporter?
std::cerr << "\n[Unable to match any test cases with: " << *it << "]" << std::endl; std::cerr << "\n[Unable to match any test cases with: " << *it << "]" << std::endl;
} }
config.getReporter()->EndGroup( *it, runner.getSuccessCount()-prevSuccess, runner.getFailureCount()-prevFail );
} }
} }
return runner.getFailureCount(); return runner.getFailureCount();

View File

@ -195,6 +195,8 @@ struct IResultListener
{ {
virtual ~IResultListener(){} virtual ~IResultListener(){}
virtual void testEnded( const ResultInfo& result ) = 0; virtual void testEnded( const ResultInfo& result ) = 0;
virtual bool sectionStarted( const std::string& name, const std::string& description, std::size_t& successes, std::size_t& failures ) = 0;
virtual void sectionEnded( const std::string& name, std::size_t successes, std::size_t failures ) = 0;
}; };
class ResultsCapture class ResultsCapture
@ -269,6 +271,16 @@ public:
{ {
} }
static bool acceptSectionStart( const std::string& name, const std::string& description, std::size_t& successes, std::size_t& failures )
{
return instance().m_listener->sectionStarted( name, description, successes, failures );
}
static void acceptSectionEnd( const std::string& name, std::size_t successes, std::size_t failures )
{
instance().m_listener->sectionEnded( name, successes, failures );
}
private: private:
MutableResultInfo currentResult; MutableResultInfo currentResult;
IResultListener* m_listener; IResultListener* m_listener;

View File

@ -79,16 +79,19 @@ namespace Catch
{ {
virtual ~ITestReporter(){} virtual ~ITestReporter(){}
// !TBD virtual void StartTesting() = 0;
// StartTesting virtual void EndTesting( std::size_t succeeded, std::size_t failed ) = 0;
// EndTesting
// StartGroup virtual void StartGroup( const std::string& groupName ) = 0;
// EndGroup virtual void EndGroup( const std::string& groupName, std::size_t succeeded, std::size_t failed ) = 0;
// StartSection
// EndSection virtual void StartSection( const std::string& sectionName, const std::string description ) = 0;
virtual void EndSection( const std::string& sectionName, std::size_t succeeded, std::size_t failed ) = 0;
virtual void StartTestCase( const TestCaseInfo& testInfo ) = 0; virtual void StartTestCase( const TestCaseInfo& testInfo ) = 0;
virtual void Result( const ResultInfo& result ) = 0;
virtual void EndTestCase( const TestCaseInfo& testInfo ) = 0; virtual void EndTestCase( const TestCaseInfo& testInfo ) = 0;
virtual void Result( const ResultInfo& result ) = 0;
}; };
struct IReporterFactory struct IReporterFactory

View File

@ -20,13 +20,15 @@ namespace Catch
{ {
Unknown = -1, Unknown = -1,
Ok = 0, Ok = 0,
ExpressionFailed = 1, Info = 1,
Warning = 2,
Info = 2, FailureBit = 0x10,
Warning = 3,
ExplicitFailure = 4,
Exception = 0x100, ExpressionFailed = FailureBit | 1,
ExplicitFailure = FailureBit | 2,
Exception = 0x110,
ThrewException = Exception | 1, ThrewException = Exception | 1,
DidntThrowException = Exception | 2 DidntThrowException = Exception | 2
@ -58,7 +60,7 @@ namespace Catch
bool ok() const bool ok() const
{ {
return m_result == ResultWas::Ok; return ( m_result & ResultWas::FailureBit ) != ResultWas::FailureBit;
} }
ResultWas::OfType getResultType() const ResultWas::OfType getResultType() const

View File

@ -48,16 +48,17 @@ namespace Catch
class Runner : public IResultListener class Runner : public IResultListener
{ {
public: public:
Runner() explicit Runner( ITestReporter* reporter )
: m_successes( 0 ), : m_successes( 0 ),
m_failures( 0 ), m_failures( 0 ),
m_reporter( 0 ) m_reporter( reporter )
{ {
m_reporter->StartTesting();
} }
void setReporter( ITestReporter* reporter ) ~Runner()
{ {
m_reporter = reporter; m_reporter->EndTesting( m_successes, m_failures );
} }
void runAll() void runAll()
@ -135,6 +136,19 @@ namespace Catch
m_reporter->Result( result ); m_reporter->Result( result );
} }
virtual bool sectionStarted( const std::string& name, const std::string& description, std::size_t& successes, std::size_t& failures )
{
m_reporter->StartSection( name, description );
successes = m_successes;
failures = m_failures;
return true;
}
virtual void sectionEnded( const std::string& name, std::size_t prevSuccesses, std::size_t prevFailures )
{
m_reporter->EndSection( name, m_successes - prevSuccesses, m_failures - prevFailures );
}
private: private:
std::size_t m_successes; std::size_t m_successes;
std::size_t m_failures; std::size_t m_failures;

View File

@ -13,6 +13,8 @@
#ifndef TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED #define TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED
#include "catch_capture.hpp"
#include <string> #include <string>
namespace Catch namespace Catch
@ -21,25 +23,27 @@ namespace Catch
{ {
public: public:
Section( const std::string& name, const std::string& description ) Section( const std::string& name, const std::string& description )
: m_name( name ), m_description( description ) : m_name( name ),
m_sectionIncluded( ResultsCapture::acceptSectionStart( name, description, m_successes, m_failures ) )
{ {
ResultsCapture::acceptSectionStart( name, description );
} }
~Section() ~Section()
{ {
ResultsCapture::acceptSectionEnd( m_name ); ResultsCapture::acceptSectionEnd( m_name, m_successes, m_failures );
} }
// This returns whether the section should be included or not // This indicates whether the section should be executed or not
operator bool() operator bool()
{ {
// !TBD get this from runner return m_sectionIncluded;
return true;
} }
private: private:
std::string m_name; std::string m_name;
std::string m_description; std::size_t m_successes;
std::size_t m_failures;
bool m_sectionIncluded;
}; };
} // end namespace Catch } // end namespace Catch