mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
--filenames-as-tags
This commit is contained in:
@@ -174,6 +174,10 @@ namespace Catch {
|
||||
.describe( "force colourised output" )
|
||||
.bind( &ConfigData::forceColour );
|
||||
|
||||
cli["--filenames-as-tags"]
|
||||
.describe( "adds a tag for the filename" )
|
||||
.bind( &ConfigData::filenamesAsTags );
|
||||
|
||||
return cli;
|
||||
}
|
||||
|
||||
|
@@ -38,6 +38,7 @@ namespace Catch {
|
||||
showHelp( false ),
|
||||
showInvisibles( false ),
|
||||
forceColour( false ),
|
||||
filenamesAsTags( false ),
|
||||
abortAfter( -1 ),
|
||||
rngSeed( 0 ),
|
||||
verbosity( Verbosity::Normal ),
|
||||
@@ -57,6 +58,7 @@ namespace Catch {
|
||||
bool showHelp;
|
||||
bool showInvisibles;
|
||||
bool forceColour;
|
||||
bool filenamesAsTags;
|
||||
|
||||
int abortAfter;
|
||||
unsigned int rngSeed;
|
||||
|
@@ -40,6 +40,8 @@ namespace Catch {
|
||||
|
||||
TestCaseInfo( TestCaseInfo const& other );
|
||||
|
||||
friend void setTags( TestCaseInfo& testCaseInfo, std::set<std::string> const& tags );
|
||||
|
||||
bool isHidden() const;
|
||||
bool throws() const;
|
||||
bool okToFail() const;
|
||||
|
@@ -88,11 +88,26 @@ namespace Catch {
|
||||
tags.insert( "hide" );
|
||||
tags.insert( "." );
|
||||
}
|
||||
|
||||
|
||||
TestCaseInfo info( _name, _className, desc, tags, _lineInfo );
|
||||
return TestCase( _testCase, info );
|
||||
}
|
||||
|
||||
void setTags( TestCaseInfo& testCaseInfo, std::set<std::string> const& tags )
|
||||
{
|
||||
testCaseInfo.tags = tags;
|
||||
testCaseInfo.lcaseTags.clear();
|
||||
|
||||
std::ostringstream oss;
|
||||
for( std::set<std::string>::const_iterator it = tags.begin(), itEnd = tags.end(); it != itEnd; ++it ) {
|
||||
oss << "[" << *it << "]";
|
||||
std::string lcaseTag = toLower( *it );
|
||||
testCaseInfo.properties = static_cast<TestCaseInfo::SpecialProperties>( testCaseInfo.properties | parseSpecialTag( lcaseTag ) );
|
||||
testCaseInfo.lcaseTags.insert( lcaseTag );
|
||||
}
|
||||
testCaseInfo.tagsAsString = oss.str();
|
||||
}
|
||||
|
||||
TestCaseInfo::TestCaseInfo( std::string const& _name,
|
||||
std::string const& _className,
|
||||
std::string const& _description,
|
||||
@@ -101,18 +116,10 @@ namespace Catch {
|
||||
: name( _name ),
|
||||
className( _className ),
|
||||
description( _description ),
|
||||
tags( _tags ),
|
||||
lineInfo( _lineInfo ),
|
||||
properties( None )
|
||||
{
|
||||
std::ostringstream oss;
|
||||
for( std::set<std::string>::const_iterator it = _tags.begin(), itEnd = _tags.end(); it != itEnd; ++it ) {
|
||||
oss << "[" << *it << "]";
|
||||
std::string lcaseTag = toLower( *it );
|
||||
properties = static_cast<SpecialProperties>( properties | parseSpecialTag( lcaseTag ) );
|
||||
lcaseTags.insert( lcaseTag );
|
||||
}
|
||||
tagsAsString = oss.str();
|
||||
setTags( *this, _tags );
|
||||
}
|
||||
|
||||
TestCaseInfo::TestCaseInfo( TestCaseInfo const& other )
|
||||
|
Reference in New Issue
Block a user