mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Version uses constructor instead of initialiser to avoid warnings
This commit is contained in:
parent
602880f5ab
commit
b56aaf4c36
@ -3,7 +3,7 @@ import sys
|
|||||||
import re
|
import re
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
versionParser = re.compile( r'(\s*Version\slibraryVersion\s*=)\s*{\s*(.*)\s*,\s*(.*)\s*,\s*(.*)\s*,\s*\"(.*)\"\s*}.*' )
|
versionParser = re.compile( r'(\s*Version\slibraryVersion)\s*\(\s*(.*)\s*,\s*(.*)\s*,\s*(.*)\s*,\s*\"(.*)\"\s*\).*' )
|
||||||
includesParser = re.compile( r'\s*#include\s*"(.*)"' )
|
includesParser = re.compile( r'\s*#include\s*"(.*)"' )
|
||||||
guardParser = re.compile( r'\s*#.*_INCLUDED')
|
guardParser = re.compile( r'\s*#.*_INCLUDED')
|
||||||
defineParser = re.compile( r'\s*#define')
|
defineParser = re.compile( r'\s*#define')
|
||||||
@ -65,7 +65,7 @@ class Version:
|
|||||||
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()
|
||||||
|
@ -213,11 +213,11 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( !displayedSpecificOption ) {
|
if( !displayedSpecificOption ) {
|
||||||
std::cout << "\nCATCH v" << libraryVersion.MajorVersion << "."
|
std::cout << "\nCATCH v" << libraryVersion.majorVersion << "."
|
||||||
<< libraryVersion.MinorVersion << " build "
|
<< libraryVersion.minorVersion << " build "
|
||||||
<< libraryVersion.BuildNumber;
|
<< libraryVersion.buildNumber;
|
||||||
if( libraryVersion.BranchName != "master" )
|
if( libraryVersion.branchName != "master" )
|
||||||
std::cout << " (" << libraryVersion.BranchName << " branch)";
|
std::cout << " (" << libraryVersion.branchName << " branch)";
|
||||||
|
|
||||||
std::cout << "\n\n" << parser.exeName() << " is a CATCH host application. Options are as follows:\n\n";
|
std::cout << "\n\n" << parser.exeName() << " is a CATCH host application. Options are as follows:\n\n";
|
||||||
showUsage( std::cout );
|
showUsage( std::cout );
|
||||||
|
@ -12,10 +12,20 @@ namespace Catch {
|
|||||||
|
|
||||||
// Versioning information
|
// Versioning information
|
||||||
struct Version {
|
struct Version {
|
||||||
const unsigned int MajorVersion;
|
Version( unsigned int _majorVersion,
|
||||||
const unsigned int MinorVersion;
|
unsigned int _minorVersion,
|
||||||
const unsigned int BuildNumber;
|
unsigned int _buildNumber,
|
||||||
const std::string BranchName;
|
std::string const& _branchName )
|
||||||
|
: majorVersion( _majorVersion ),
|
||||||
|
minorVersion( _minorVersion ),
|
||||||
|
buildNumber( _buildNumber ),
|
||||||
|
branchName( _branchName )
|
||||||
|
{}
|
||||||
|
|
||||||
|
const unsigned int majorVersion;
|
||||||
|
const unsigned int minorVersion;
|
||||||
|
const unsigned int buildNumber;
|
||||||
|
const std::string branchName;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Version libraryVersion;
|
extern Version libraryVersion;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
// These numbers are maintained by a script
|
// These numbers are maintained by a script
|
||||||
Version libraryVersion = { 0, 9, 6, "integration" };
|
Version libraryVersion( 0, 9, 6, "integration" );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED
|
||||||
|
Loading…
Reference in New Issue
Block a user