mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 05:16: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 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*"(.*)"' )
|
||||
guardParser = re.compile( r'\s*#.*_INCLUDED')
|
||||
defineParser = re.compile( r'\s*#define')
|
||||
@ -65,7 +65,7 @@ class Version:
|
||||
for line in f:
|
||||
m = versionParser.match( line )
|
||||
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:
|
||||
lines.append( line.rstrip() )
|
||||
f.close()
|
||||
|
@ -213,11 +213,11 @@ namespace Catch {
|
||||
}
|
||||
|
||||
if( !displayedSpecificOption ) {
|
||||
std::cout << "\nCATCH v" << libraryVersion.MajorVersion << "."
|
||||
<< libraryVersion.MinorVersion << " build "
|
||||
<< libraryVersion.BuildNumber;
|
||||
if( libraryVersion.BranchName != "master" )
|
||||
std::cout << " (" << libraryVersion.BranchName << " branch)";
|
||||
std::cout << "\nCATCH v" << libraryVersion.majorVersion << "."
|
||||
<< libraryVersion.minorVersion << " build "
|
||||
<< libraryVersion.buildNumber;
|
||||
if( libraryVersion.branchName != "master" )
|
||||
std::cout << " (" << libraryVersion.branchName << " branch)";
|
||||
|
||||
std::cout << "\n\n" << parser.exeName() << " is a CATCH host application. Options are as follows:\n\n";
|
||||
showUsage( std::cout );
|
||||
|
@ -12,10 +12,20 @@ namespace Catch {
|
||||
|
||||
// Versioning information
|
||||
struct Version {
|
||||
const unsigned int MajorVersion;
|
||||
const unsigned int MinorVersion;
|
||||
const unsigned int BuildNumber;
|
||||
const std::string BranchName;
|
||||
Version( unsigned int _majorVersion,
|
||||
unsigned int _minorVersion,
|
||||
unsigned int _buildNumber,
|
||||
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;
|
||||
|
@ -13,7 +13,7 @@
|
||||
namespace Catch {
|
||||
|
||||
// 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
|
||||
|
Loading…
Reference in New Issue
Block a user