Fixed broken single header following script change

- fixed the script (was missing #ifdefs)
- also fixed single include (Xcode) test project
- build 16
This commit is contained in:
Phil Nash 2013-12-04 20:25:14 +00:00
parent 87b20e8dab
commit de49ec4d7c
6 changed files with 120 additions and 124 deletions

View File

@ -1,6 +1,6 @@
![catch logo](catch-logo-small.png) ![catch logo](catch-logo-small.png)
*v1.0 build 15 (master branch)* *v1.0 build 16 (master branch)*
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)

View File

@ -13,7 +13,7 @@
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion( 1, 0, 15, "master" ); Version libraryVersion( 1, 0, 16, "master" );
} }
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED

View File

@ -14,13 +14,6 @@
#pragma clang diagnostic ignored "-Wweak-vtables" #pragma clang diagnostic ignored "-Wweak-vtables"
#endif #endif
#include "internal/catch_text.h"
#include "internal/catch_console_colour.hpp"
#include "internal/catch_commandline.hpp"
#include "internal/catch_test_spec.h"
#include "reporters/catch_reporter_xml.hpp"
template<size_t size> template<size_t size>
void parseIntoConfig( const char * (&argv)[size], Catch::ConfigData& config ) { void parseIntoConfig( const char * (&argv)[size], Catch::ConfigData& config ) {
Clara::CommandLine<Catch::ConfigData> parser = Catch::makeCommandLineParser(); Clara::CommandLine<Catch::ConfigData> parser = Catch::makeCommandLineParser();

View File

@ -8,7 +8,6 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
4A2894D615D3956000E20735 /* ApproxTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894D515D3956000E20735 /* ApproxTests.cpp */; }; 4A2894D615D3956000E20735 /* ApproxTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894D515D3956000E20735 /* ApproxTests.cpp */; };
4AB735F815D396ED00F9F7C3 /* catch_self_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894D815D3957500E20735 /* catch_self_test.cpp */; };
4AB735FA15D396F400F9F7C3 /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894E015D3957500E20735 /* TestMain.cpp */; }; 4AB735FA15D396F400F9F7C3 /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894E015D3957500E20735 /* TestMain.cpp */; };
4AB735FB15D3970C00F9F7C3 /* ClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894DA15D3957500E20735 /* ClassTests.cpp */; }; 4AB735FB15D3970C00F9F7C3 /* ClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894DA15D3957500E20735 /* ClassTests.cpp */; };
4AB735FC15D3971100F9F7C3 /* ConditionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894DB15D3957500E20735 /* ConditionTests.cpp */; }; 4AB735FC15D3971100F9F7C3 /* ConditionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894DB15D3957500E20735 /* ConditionTests.cpp */; };
@ -33,8 +32,6 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
4A2894D515D3956000E20735 /* ApproxTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ApproxTests.cpp; path = ../../../SelfTest/ApproxTests.cpp; sourceTree = "<group>"; }; 4A2894D515D3956000E20735 /* ApproxTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ApproxTests.cpp; path = ../../../SelfTest/ApproxTests.cpp; sourceTree = "<group>"; };
4A2894D815D3957500E20735 /* catch_self_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = catch_self_test.cpp; path = ../../../SelfTest/catch_self_test.cpp; sourceTree = "<group>"; };
4A2894D915D3957500E20735 /* catch_self_test.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = catch_self_test.hpp; path = ../../../SelfTest/catch_self_test.hpp; sourceTree = "<group>"; };
4A2894DA15D3957500E20735 /* ClassTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ClassTests.cpp; path = ../../../SelfTest/ClassTests.cpp; sourceTree = "<group>"; }; 4A2894DA15D3957500E20735 /* ClassTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ClassTests.cpp; path = ../../../SelfTest/ClassTests.cpp; sourceTree = "<group>"; };
4A2894DB15D3957500E20735 /* ConditionTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ConditionTests.cpp; path = ../../../SelfTest/ConditionTests.cpp; sourceTree = "<group>"; }; 4A2894DB15D3957500E20735 /* ConditionTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ConditionTests.cpp; path = ../../../SelfTest/ConditionTests.cpp; sourceTree = "<group>"; };
4A2894DC15D3957500E20735 /* ExceptionTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ExceptionTests.cpp; path = ../../../SelfTest/ExceptionTests.cpp; sourceTree = "<group>"; }; 4A2894DC15D3957500E20735 /* ExceptionTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ExceptionTests.cpp; path = ../../../SelfTest/ExceptionTests.cpp; sourceTree = "<group>"; };
@ -61,8 +58,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
4A2894E015D3957500E20735 /* TestMain.cpp */, 4A2894E015D3957500E20735 /* TestMain.cpp */,
4A2894D815D3957500E20735 /* catch_self_test.cpp */,
4A2894D915D3957500E20735 /* catch_self_test.hpp */,
); );
name = "Self Test"; name = "Self Test";
sourceTree = "<group>"; sourceTree = "<group>";
@ -159,7 +154,6 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
4A2894D615D3956000E20735 /* ApproxTests.cpp in Sources */, 4A2894D615D3956000E20735 /* ApproxTests.cpp in Sources */,
4AB735F815D396ED00F9F7C3 /* catch_self_test.cpp in Sources */,
4AB735FA15D396F400F9F7C3 /* TestMain.cpp in Sources */, 4AB735FA15D396F400F9F7C3 /* TestMain.cpp in Sources */,
4AB735FB15D3970C00F9F7C3 /* ClassTests.cpp in Sources */, 4AB735FB15D3970C00F9F7C3 /* ClassTests.cpp in Sources */,
4AB735FC15D3971100F9F7C3 /* ConditionTests.cpp in Sources */, 4AB735FC15D3971100F9F7C3 /* ConditionTests.cpp in Sources */,
@ -224,6 +218,7 @@
4A90B5E115D2E3E900EF71BC /* Debug */ = { 4A90B5E115D2E3E900EF71BC /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
HEADER_SEARCH_PATHS = "../../../single_include/**"; HEADER_SEARCH_PATHS = "../../../single_include/**";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
}; };
@ -232,6 +227,7 @@
4A90B5E215D2E3E900EF71BC /* Release */ = { 4A90B5E215D2E3E900EF71BC /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
HEADER_SEARCH_PATHS = "../../../single_include/**"; HEADER_SEARCH_PATHS = "../../../single_include/**";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
}; };

View File

@ -26,125 +26,126 @@ bumpVersion = True
includeImpl = True includeImpl = True
for arg in sys.argv[1:]: for arg in sys.argv[1:]:
arg = string.lower(arg) arg = string.lower(arg)
if arg == "nobump": if arg == "nobump":
bumpVersion = False bumpVersion = False
print "Not bumping version number" print "Not bumping version number"
elif arg == "noimpl": elif arg == "noimpl":
includeImpl = False includeImpl = False
bumpVersion = False bumpVersion = False
print "Not including impl code (and not bumping version)" print "Not including impl code (and not bumping version)"
else: else:
print "\n** Unrecognised argument: " + arg + " **\n" print "\n** Unrecognised argument: " + arg + " **\n"
exit(1) exit(1)
out = open( outputPath, 'w' ) out = open( outputPath, 'w' )
ifdefs = 0 ifdefs = 0
implIfDefs = -1 implIfDefs = -1
def write( line ): def write( line ):
if includeImpl or implIfDefs == -1: if includeImpl or implIfDefs == -1:
out.write( line ) out.write( line )
def parseFile( path, filename ): def parseFile( path, filename ):
global ifdefs global ifdefs
global implIfDefs global implIfDefs
f = open( path + filename, 'r' ) f = open( path + filename, 'r' )
blanks = 0 blanks = 0
for line in f: for line in f:
if ifParser.match( line ): if ifParser.match( line ):
ifdefs = ifdefs + 1 ifdefs = ifdefs + 1
elif endIfParser.match( line ): elif endIfParser.match( line ):
ifdefs = ifdefs - 1 ifdefs = ifdefs - 1
m = includesParser.match( line ) m = includesParser.match( line )
if m: if m:
header = m.group(1) header = m.group(1)
headerPath, sep, headerFile = header.rpartition( "/" ) headerPath, sep, headerFile = header.rpartition( "/" )
if not headerFile in seenHeaders: if not headerFile in seenHeaders:
seenHeaders.add( headerFile ) seenHeaders.add( headerFile )
write( "// #included from: {0}\n".format( header ) ) write( "// #included from: {0}\n".format( header ) )
if( headerPath == "internal" and path.endswith( "internal/" ) ): if( headerPath == "internal" and path.endswith( "internal/" ) ):
headerPath = "" headerPath = ""
sep = "" sep = ""
if os.path.exists( path + headerPath + sep + headerFile ): if os.path.exists( path + headerPath + sep + headerFile ):
parseFile( path + headerPath + sep, headerFile ) parseFile( path + headerPath + sep, headerFile )
else: else:
parseFile( rootPath + headerPath + sep, headerFile ) parseFile( rootPath + headerPath + sep, headerFile )
elif ifImplParser.match(line): else:
implIfDefs = ifdefs if ifImplParser.match(line):
elif (not guardParser.match( line ) or defineParser.match( line ) ) and not commentParser1.match( line )and not commentParser2.match( line ): implIfDefs = ifdefs
if blankParser.match( line ): if (not guardParser.match( line ) or defineParser.match( line ) ) and not commentParser1.match( line )and not commentParser2.match( line ):
blanks = blanks + 1 if blankParser.match( line ):
else: blanks = blanks + 1
blanks = 0 else:
if blanks < 2: blanks = 0
write( line.rstrip() + "\n" ) if blanks < 2:
write( line.rstrip() + "\n" )
class Version: class Version:
def __init__(self): def __init__(self):
f = open( versionPath, 'r' ) f = open( versionPath, 'r' )
for line in f: for line in f:
m = versionParser.match( line ) m = versionParser.match( line )
if m: if m:
self.variableDecl = m.group(1) self.variableDecl = m.group(1)
self.majorVersion = int(m.group(2)) self.majorVersion = int(m.group(2))
self.minorVersion = int(m.group(3)) self.minorVersion = int(m.group(3))
self.buildNumber = int(m.group(4)) self.buildNumber = int(m.group(4))
self.branchName = m.group(5) self.branchName = m.group(5)
f.close() f.close()
def incrementBuildNumber(self): def incrementBuildNumber(self):
self.buildNumber = self.buildNumber+1 self.buildNumber = self.buildNumber+1
def updateVersionFile(self): def updateVersionFile(self):
f = open( versionPath, 'r' ) f = open( versionPath, 'r' )
lines = [] lines = []
for line in f: for line in f:
m = versionParser.match( line ) m = versionParser.match( line )
if m: if m:
lines.append( '{0}( {1}, {2}, {3}, "{4}" );'.format( self.variableDecl, self.majorVersion, self.minorVersion, self.buildNumber, self.branchName ) ) lines.append( '{0}( {1}, {2}, {3}, "{4}" );'.format( self.variableDecl, self.majorVersion, self.minorVersion, self.buildNumber, self.branchName ) )
else: else:
lines.append( line.rstrip() ) lines.append( line.rstrip() )
f.close() f.close()
f = open( versionPath, 'w' ) f = open( versionPath, 'w' )
for line in lines: for line in lines:
f.write( line + "\n" ) f.write( line + "\n" )
def updateReadmeFile(self): def updateReadmeFile(self):
f = open( readmePath, 'r' ) f = open( readmePath, 'r' )
lines = [] lines = []
for line in f: for line in f:
lines.append( line.rstrip() ) lines.append( line.rstrip() )
f.close() f.close()
f = open( readmePath, 'w' ) f = open( readmePath, 'w' )
for line in lines: for line in lines:
if line.startswith( "*v" ): if line.startswith( "*v" ):
f.write( '*v{0}.{1} build {2} ({3} branch)*\n'.format( self.majorVersion, self.minorVersion, self.buildNumber, self.branchName ) ) f.write( '*v{0}.{1} build {2} ({3} branch)*\n'.format( self.majorVersion, self.minorVersion, self.buildNumber, self.branchName ) )
else: else:
f.write( line + "\n" ) f.write( line + "\n" )
def generateSingleInclude(): def generateSingleInclude():
v = Version() v = Version()
if bumpVersion: if bumpVersion:
v.incrementBuildNumber() v.incrementBuildNumber()
v.updateVersionFile() v.updateVersionFile()
v.updateReadmeFile() v.updateReadmeFile()
out.write( "/*\n" ) out.write( "/*\n" )
out.write( " * CATCH v{0}.{1} build {2} ({3} branch)\n".format( v.majorVersion, v.minorVersion, v.buildNumber, v.branchName ) ) out.write( " * CATCH v{0}.{1} build {2} ({3} branch)\n".format( v.majorVersion, v.minorVersion, v.buildNumber, v.branchName ) )
out.write( " * Generated: {0}\n".format( datetime.datetime.now() ) ) out.write( " * Generated: {0}\n".format( datetime.datetime.now() ) )
out.write( " * ----------------------------------------------------------\n" ) out.write( " * ----------------------------------------------------------\n" )
out.write( " * This file has been merged from multiple headers. Please don't edit it directly\n" ) out.write( " * This file has been merged from multiple headers. Please don't edit it directly\n" )
out.write( " * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.\n" ) out.write( " * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.\n" )
out.write( " *\n" ) out.write( " *\n" )
out.write( " * Distributed under the Boost Software License, Version 1.0. (See accompanying\n" ) out.write( " * Distributed under the Boost Software License, Version 1.0. (See accompanying\n" )
out.write( " * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" ) out.write( " * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" )
out.write( " */\n" ) out.write( " */\n" )
out.write( "#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" ) out.write( "#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
out.write( "#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" ) out.write( "#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
parseFile( rootPath, 'catch.hpp' ) parseFile( rootPath, 'catch.hpp' )
out.write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" ) out.write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
generateSingleInclude() generateSingleInclude()

View File

@ -1,6 +1,6 @@
/* /*
* CATCH v1.0 build 15 (master branch) * CATCH v1.0 build 16 (master branch)
* Generated: 2013-12-03 18:52:51.480072 * Generated: 2013-12-04 20:23:35.145591
* ---------------------------------------------------------- * ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly * This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@ -178,7 +178,7 @@ namespace Catch {
struct SourceLineInfo { struct SourceLineInfo {
SourceLineInfo(); SourceLineInfo();
SourceLineInfo( std::string const& _file, std::size_t _line ); SourceLineInfo( char const* _file, std::size_t _line );
SourceLineInfo( SourceLineInfo const& other ); SourceLineInfo( SourceLineInfo const& other );
bool empty() const; bool empty() const;
bool operator == ( SourceLineInfo const& other ) const; bool operator == ( SourceLineInfo const& other ) const;
@ -2591,6 +2591,7 @@ return @ desc; \
#endif #endif
#if defined( CATCH_CONFIG_MAIN ) || defined( CATCH_CONFIG_RUNNER )
// #included from: internal/catch_impl.hpp // #included from: internal/catch_impl.hpp
#define TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED #define TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED
@ -5786,6 +5787,10 @@ namespace Catch {
if( tags.find( "hide" ) != tags.end() || tags.find( "." ) != tags.end() ) if( tags.find( "hide" ) != tags.end() || tags.find( "." ) != tags.end() )
isHidden = true; isHidden = true;
if( isHidden ) {
tags.insert( "hide" );
tags.insert( "." );
}
TestCaseInfo info( _name, _className, desc, tags, isHidden, _lineInfo ); TestCaseInfo info( _name, _className, desc, tags, isHidden, _lineInfo );
return TestCase( _testCase, info ); return TestCase( _testCase, info );
} }
@ -6134,7 +6139,7 @@ namespace Catch {
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion( 1, 0, 15, "master" ); Version libraryVersion( 1, 0, 16, "master" );
} }
// #included from: catch_text.hpp // #included from: catch_text.hpp
@ -6473,7 +6478,7 @@ namespace Catch {
} }
SourceLineInfo::SourceLineInfo() : line( 0 ){} SourceLineInfo::SourceLineInfo() : line( 0 ){}
SourceLineInfo::SourceLineInfo( std::string const& _file, std::size_t _line ) SourceLineInfo::SourceLineInfo( char const* _file, std::size_t _line )
: file( _file ), : file( _file ),
line( _line ) line( _line )
{} {}
@ -7866,6 +7871,7 @@ namespace Catch {
#endif // CATCH_CONFIG_MAIN || CATCH_CONFIG_RUNNER #endif // CATCH_CONFIG_MAIN || CATCH_CONFIG_RUNNER
#ifdef CATCH_CONFIG_MAIN
// #included from: internal/catch_default_main.hpp // #included from: internal/catch_default_main.hpp
#define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED #define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED