1
0
mirror of https://github.com/catchorg/Catch2.git synced 2025-01-15 14:48:00 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Martin Hořeňovský
d36c15c3ca
Store tags in one big pre-allocated string and only work with refs
This should decrease the number of allocations before main is entered
significantly, but complicates the code somewhat in return.

Assuming I used `massif` right, doing just `SelfTest --list-tests`
went from 929 allocations at "Remove gcc-4.9 from the travis builds"
(2 commits up), to 614 allocations with this commit.
2019-11-14 10:53:12 +01:00
Martin Hořeňovský
302e2c0b06
Do not copy around TestCaseInfo
Now a `TEST_CASE` macro should create a single TestCaseInfo and then
it should never be copied around. This, together with latter changes,
should significantly decrease the number of allocations made before
`main` is even entered.
2019-11-14 10:52:34 +01:00
36 changed files with 907 additions and 793 deletions

View File

@ -21,6 +21,10 @@ std::string ws(int const level) {
return std::string( 2 * level, ' ' );
}
std::ostream& operator<<(std::ostream& out, Catch::Tag t) {
return out << "original: " << t.original << "lower cased: " << t.lowerCased;
}
template< typename T >
std::ostream& operator<<( std::ostream& os, std::vector<T> const& v ) {
os << "{ ";
@ -119,31 +123,36 @@ void print( std::ostream& os, int const level, std::string const& title, Catch::
os << ws(level+1) << "- aborting: " << info.aborting << "\n";
}
// struct TestCaseInfo {
// enum SpecialProperties{
// None = 0,
// IsHidden = 1 << 1,
// ShouldFail = 1 << 2,
// MayFail = 1 << 3,
// Throws = 1 << 4,
// NonPortable = 1 << 5,
// Benchmark = 1 << 6
// };
// struct Tag {
// StringRef original, lowerCased;
// };
//
// bool isHidden() const;
// bool throws() const;
// bool okToFail() const;
// bool expectedToFail() const;
//
// std::string tagsAsString() const;
// enum class TestCaseProperties : uint8_t {
// None = 0,
// IsHidden = 1 << 1,
// ShouldFail = 1 << 2,
// MayFail = 1 << 3,
// Throws = 1 << 4,
// NonPortable = 1 << 5,
// Benchmark = 1 << 6
// };
//
// std::string name;
// std::string className;
// std::vector<std::string> tags;
// std::vector<std::string> lcaseTags;
// SourceLineInfo lineInfo;
// SpecialProperties properties;
// };
//
// struct TestCaseInfo : NonCopyable {
//
// bool isHidden() const;
// bool throws() const;
// bool okToFail() const;
// bool expectedToFail() const;
//
//
// std::string name;
// std::string className;
// std::vector<Tag> tags;
// SourceLineInfo lineInfo;
// TestCaseProperties properties = TestCaseProperties::None;
// };
void print( std::ostream& os, int const level, std::string const& title, Catch::TestCaseInfo const& info ) {
os << ws(level ) << title << ":\n"
@ -154,10 +163,9 @@ void print( std::ostream& os, int const level, std::string const& title, Catch::
<< ws(level+1) << "- tagsAsString(): '" << info.tagsAsString() << "'\n"
<< ws(level+1) << "- name: '" << info.name << "'\n"
<< ws(level+1) << "- className: '" << info.className << "'\n"
<< ws(level+1) << "- tags: " << info.tags << "\n"
<< ws(level+1) << "- lcaseTags: " << info.lcaseTags << "\n";
<< ws(level+1) << "- tags: " << info.tags << "\n";
print( os, level+1 , "- lineInfo", info.lineInfo );
os << ws(level+1) << "- properties (flags): 0x" << std::hex << info.properties << std::dec << "\n";
os << ws(level+1) << "- properties (flags): 0x" << std::hex << static_cast<uint32_t>(info.properties) << std::dec << "\n";
}
// struct TestCaseStats {
@ -170,7 +178,7 @@ void print( std::ostream& os, int const level, std::string const& title, Catch::
void print( std::ostream& os, int const level, std::string const& title, Catch::TestCaseStats const& info ) {
os << ws(level ) << title << ":\n";
print( os, level+1 , "- testInfo", info.testInfo );
print( os, level+1 , "- testInfo", *info.testInfo );
print( os, level+1 , "- totals" , info.totals );
os << ws(level+1) << "- stdOut: " << info.stdOut << "\n"
<< ws(level+1) << "- stdErr: " << info.stdErr << "\n"

View File

@ -15,13 +15,15 @@
namespace Catch {
class TestCase;
class TestCaseHandle;
struct TestCaseInfo;
struct ITestCaseRegistry;
struct IExceptionTranslatorRegistry;
struct IExceptionTranslator;
struct IReporterRegistry;
struct IReporterFactory;
struct ITagAliasRegistry;
struct ITestInvoker;
struct IMutableEnumValuesRegistry;
class StartupExceptionRegistry;
@ -44,7 +46,7 @@ namespace Catch {
virtual ~IMutableRegistryHub();
virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0;
virtual void registerListener( IReporterFactoryPtr const& factory ) = 0;
virtual void registerTest( TestCase const& testInfo ) = 0;
virtual void registerTest(std::unique_ptr<TestCaseInfo>&& testInfo, std::unique_ptr<ITestInvoker>&& invoker) = 0;
virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0;
virtual void registerStartupException() noexcept = 0;

View File

@ -76,7 +76,7 @@ namespace Catch {
std::string const& _stdOut,
std::string const& _stdErr,
bool _aborting )
: testInfo( _testInfo ),
: testInfo( &_testInfo ),
totals( _totals ),
stdOut( _stdOut ),
stdErr( _stdErr ),
@ -141,14 +141,15 @@ namespace Catch {
Catch::cout() << std::endl;
}
void IStreamingReporter::listTests(std::vector<TestCase> const& tests, Config const& config) {
void IStreamingReporter::listTests(std::vector<TestCaseHandle> const& tests, Config const& config) {
if (config.hasTestFilters())
Catch::cout() << "Matching test cases:\n";
else {
Catch::cout() << "All available test cases:\n";
}
for (auto const& testCaseInfo : tests) {
for (auto const& test : tests) {
auto const& testCaseInfo = test.getTestCaseInfo();
Colour::Code colour = testCaseInfo.isHidden()
? Colour::SecondaryText
: Colour::None;

View File

@ -128,7 +128,7 @@ namespace Catch {
TestCaseStats& operator = ( TestCaseStats && ) = default;
virtual ~TestCaseStats();
TestCaseInfo testInfo;
TestCaseInfo const * testInfo;
Totals totals;
std::string stdOut;
std::string stdErr;
@ -217,7 +217,7 @@ namespace Catch {
virtual void noMatchingTestCases( std::string const& spec ) = 0;
virtual void reportInvalidArguments(std::string const&) {}
virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0;
virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0;
@ -250,7 +250,7 @@ namespace Catch {
// Listing support
virtual void listReporters(std::vector<ReporterDescription> const& descriptions, Config const& config);
virtual void listTests(std::vector<TestCase> const& tests, Config const& config);
virtual void listTests(std::vector<TestCaseHandle> const& tests, Config const& config);
virtual void listTags(std::vector<TagInfo> const& tags, Config const& config);
};

View File

@ -9,29 +9,32 @@
#define TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED
#include <vector>
#include <memory>
namespace Catch {
class TestSpec;
struct TestCaseInfo;
struct ITestInvoker {
virtual void invoke () const = 0;
virtual ~ITestInvoker();
};
class TestCase;
class TestCaseHandle;
struct IConfig;
struct ITestCaseRegistry {
virtual ~ITestCaseRegistry();
virtual std::vector<TestCase> const& getAllTests() const = 0;
virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const = 0;
virtual std::vector<std::unique_ptr<TestCaseInfo>> const& getAllInfos() const = 0;
virtual std::vector<TestCaseHandle> const& getAllTests() const = 0;
virtual std::vector<TestCaseHandle> const& getAllTestsSorted( IConfig const& config ) const = 0;
};
bool isThrowSafe( TestCase const& testCase, IConfig const& config );
bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );
std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );
bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config );
bool matchTest( TestCaseHandle const& testCase, TestSpec const& testSpec, IConfig const& config );
std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config );
std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config );
}

View File

@ -36,16 +36,15 @@ namespace Catch {
void listTags(IStreamingReporter& reporter, Config const& config) {
TestSpec testSpec = config.testSpec();
std::vector<TestCase> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
std::map<std::string, TagInfo> tagCounts;
std::map<StringRef, TagInfo> tagCounts;
for (auto const& testCase : matchedTestCases) {
for (auto const& tagName : testCase.getTestCaseInfo().tags) {
std::string lcaseTagName = toLower(tagName);
auto countIt = tagCounts.find(lcaseTagName);
if (countIt == tagCounts.end())
countIt = tagCounts.insert(std::make_pair(lcaseTagName, TagInfo())).first;
countIt->second.add(tagName);
auto it = tagCounts.find(tagName.lowerCased);
if (it == tagCounts.end())
it = tagCounts.insert(std::make_pair(tagName.lowerCased, TagInfo())).first;
it->second.add(tagName.original);
}
}
@ -71,16 +70,16 @@ namespace Catch {
} // end anonymous namespace
void TagInfo::add( std::string const& spelling ) {
void TagInfo::add( StringRef spelling ) {
++count;
spellings.insert( spelling );
}
std::string TagInfo::all() const {
size_t size = 0;
// 2 per tag for brackets '[' and ']'
size_t size = spellings.size() * 2;
for (auto const& spelling : spellings) {
// Add 2 for the brackes
size += spelling.size() + 2;
size += spelling.size();
}
std::string out; out.reserve(size);

View File

@ -23,10 +23,10 @@ namespace Catch {
};
struct TagInfo {
void add(std::string const& spelling);
void add(StringRef spelling);
std::string all() const;
std::set<std::string> spellings;
std::set<StringRef> spellings;
std::size_t count = 0;
};

View File

@ -93,7 +93,7 @@ namespace Catch {
std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );
const char* className = class_getName( cls );
getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, NameAndTags( name.c_str(), desc.c_str() ), SourceLineInfo("",0) ) );
getMutableRegistryHub().registerTest( makeTestCaseInfo( new OcMethod( cls, selector ), className, NameAndTags( name.c_str(), desc.c_str() ), SourceLineInfo("",0) ) );
noTestMethods++;
}
}

View File

@ -49,8 +49,8 @@ namespace Catch {
void registerListener( IReporterFactoryPtr const& factory ) override {
m_reporterRegistry.registerListener( factory );
}
void registerTest( TestCase const& testInfo ) override {
m_testCaseRegistry.registerTest( testInfo );
void registerTest( std::unique_ptr<TestCaseInfo>&& testInfo, std::unique_ptr<ITestInvoker>&& invoker ) override {
m_testCaseRegistry.registerTest( std::move(testInfo), std::move(invoker) );
}
void registerTranslator( const IExceptionTranslator* translator ) override {
m_exceptionTranslatorRegistry.registerTranslator( translator );

View File

@ -93,7 +93,7 @@ namespace Catch {
m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting()));
}
Totals RunContext::runTest(TestCase const& testCase) {
Totals RunContext::runTest(TestCaseHandle const& testCase) {
Totals prevTotals = m_totals;
std::string redirectedCout;

View File

@ -44,7 +44,7 @@ namespace Catch {
void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount );
void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount );
Totals runTest(TestCase const& testCase);
Totals runTest(TestCaseHandle const& testCase);
IConfigPtr config() const;
IStreamingReporter& reporter() const;
@ -133,7 +133,7 @@ namespace Catch {
TestRunInfo m_runInfo;
IMutableContext& m_context;
TestCase const* m_activeTestCase = nullptr;
TestCaseHandle const* m_activeTestCase = nullptr;
ITracker* m_testCaseTracker = nullptr;
Option<AssertionResult> m_lastResult;

View File

@ -72,7 +72,7 @@ namespace Catch {
if (m_matches.empty() && invalidArgs.empty()) {
for (auto const& test : allTestCases)
if (!test.isHidden())
if (!test.getTestCaseInfo().isHidden())
m_tests.emplace(&test);
} else {
for (auto const& match : m_matches)
@ -88,7 +88,7 @@ namespace Catch {
if (!m_context.aborting())
totals += m_context.runTest(*testCase);
else
m_context.reporter().skipTest(*testCase);
m_context.reporter().skipTest(testCase->getTestCaseInfo());
}
for (auto const& match : m_matches) {
@ -108,7 +108,7 @@ namespace Catch {
}
private:
using Tests = std::set<TestCase const*>;
using Tests = std::set<TestCaseHandle const*>;
std::shared_ptr<Config> m_config;
RunContext m_context;
@ -116,25 +116,9 @@ namespace Catch {
TestSpec::Matches m_matches;
};
void applyFilenamesAsTags(Catch::IConfig const& config) {
auto& tests = const_cast<std::vector<TestCase>&>(getAllTestCasesSorted(config));
for (auto& testCase : tests) {
auto tags = testCase.tags;
std::string filename = testCase.lineInfo.file;
auto lastSlash = filename.find_last_of("\\/");
if (lastSlash != std::string::npos) {
filename.erase(0, lastSlash);
filename[0] = '#';
}
auto lastDot = filename.find_last_of('.');
if (lastDot != std::string::npos) {
filename.erase(lastDot);
}
tags.push_back(std::move(filename));
setTags(testCase, tags);
void applyFilenamesAsTags() {
for (auto const& testInfo : getRegistryHub().getTestCaseRegistry().getAllInfos()) {
testInfo->addFilenameTag();
}
}
@ -284,8 +268,9 @@ namespace Catch {
seedRng( *m_config );
if( m_configData.filenamesAsTags )
applyFilenamesAsTags( *m_config );
if (m_configData.filenamesAsTags) {
applyFilenamesAsTags();
}
// Create reporter(s) so we can route listings through them
auto reporter = makeReporter(m_config);

View File

@ -38,6 +38,13 @@ namespace Catch {
&& (std::memcmp( m_start, other.m_start, m_size ) == 0);
}
bool StringRef::operator<(StringRef const& rhs) const noexcept {
if (m_size < rhs.m_size) {
return strncmp(m_start, rhs.m_start, m_size) <= 0;
}
return strncmp(m_start, rhs.m_start, rhs.m_size) < 0;
}
auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& {
return os.write(str.data(), str.size());
}

View File

@ -58,6 +58,8 @@ namespace Catch {
return m_start[index];
}
bool operator<(StringRef const& rhs) const noexcept;
public: // named queries
constexpr auto empty() const noexcept -> bool {
return m_size == 0;
@ -91,7 +93,6 @@ namespace Catch {
auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&;
auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&;
constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef {
return StringRef( rawChars, size );
}

View File

@ -20,27 +20,58 @@
namespace Catch {
namespace {
TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) {
if( startsWith( tag, '.' ) ||
tag == "!hide" )
return TestCaseInfo::IsHidden;
else if( tag == "!throws" )
return TestCaseInfo::Throws;
else if( tag == "!shouldfail" )
return TestCaseInfo::ShouldFail;
else if( tag == "!mayfail" )
return TestCaseInfo::MayFail;
else if( tag == "!nonportable" )
return TestCaseInfo::NonPortable;
else if( tag == "!benchmark" )
return static_cast<TestCaseInfo::SpecialProperties>( TestCaseInfo::Benchmark | TestCaseInfo::IsHidden );
using TCP_underlying_type = uint8_t;
static_assert(sizeof(TestCaseProperties) == sizeof(TCP_underlying_type),
"The size of the TestCaseProperties is different from the assumed size");
TestCaseProperties operator|(TestCaseProperties lhs, TestCaseProperties rhs) {
return static_cast<TestCaseProperties>(
static_cast<TCP_underlying_type>(lhs) | static_cast<TCP_underlying_type>(rhs)
);
}
TestCaseProperties& operator|=(TestCaseProperties& lhs, TestCaseProperties rhs) {
lhs = static_cast<TestCaseProperties>(
static_cast<TCP_underlying_type>(lhs) | static_cast<TCP_underlying_type>(rhs)
);
return lhs;
}
TestCaseProperties operator&(TestCaseProperties lhs, TestCaseProperties rhs) {
return static_cast<TestCaseProperties>(
static_cast<TCP_underlying_type>(lhs) & static_cast<TCP_underlying_type>(rhs)
);
}
bool applies(TestCaseProperties tcp) {
static_assert(static_cast<TCP_underlying_type>(TestCaseProperties::None) == 0,
"TestCaseProperties::None must be equal to 0");
return tcp != TestCaseProperties::None;
}
TestCaseProperties parseSpecialTag( StringRef tag ) {
if( (!tag.empty() && tag[0] == '.')
|| tag == "!hide"_sr )
return TestCaseProperties::IsHidden;
else if( tag == "!throws"_sr )
return TestCaseProperties::Throws;
else if( tag == "!shouldfail"_sr )
return TestCaseProperties::ShouldFail;
else if( tag == "!mayfail"_sr )
return TestCaseProperties::MayFail;
else if( tag == "!nonportable"_sr )
return TestCaseProperties::NonPortable;
else if( tag == "!benchmark"_sr )
return static_cast<TestCaseProperties>(TestCaseProperties::Benchmark | TestCaseProperties::IsHidden );
else
return TestCaseInfo::None;
return TestCaseProperties::None;
}
bool isReservedTag( std::string const& tag ) {
return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast<unsigned char>(tag[0]) );
bool isReservedTag( StringRef tag ) {
return parseSpecialTag( tag ) == TestCaseProperties::None
&& tag.size() > 0
&& !std::isalnum( static_cast<unsigned char>(tag[0]) );
}
void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
void enforceNotReservedTag( StringRef tag, SourceLineInfo const& _lineInfo ) {
CATCH_ENFORCE( !isReservedTag(tag),
"Tag name: [" << tag << "] is not allowed.\n"
<< "Tag names starting with non alphanumeric characters are reserved\n"
@ -51,90 +82,117 @@ namespace Catch {
static size_t counter = 0;
return "Anonymous test case " + std::to_string(++counter);
}
}
TestCase makeTestCase( ITestInvoker* _testCase,
std::string const& _className,
NameAndTags const& nameAndTags,
SourceLineInfo const& _lineInfo )
{
bool isHidden = false;
// Parse out tags
std::vector<std::string> tags;
std::string tag;
bool inTag = false;
for (char c : nameAndTags.tags) {
if( !inTag ) {
if (c == '[') {
inTag = true;
}
} else {
if( c == ']' ) {
TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag );
if( ( prop & TestCaseInfo::IsHidden ) != 0 )
isHidden = true;
else if( prop == TestCaseInfo::None )
enforceNotReservedTag( tag, _lineInfo );
// Merged hide tags like `[.approvals]` should be added as
// `[.][approvals]`. The `[.]` is added at later point, so
// we only strip the prefix
if (startsWith(tag, '.') && tag.size() > 1) {
tag.erase(0, 1);
}
tags.push_back( tag );
tag.clear();
inTag = false;
}
else
tag += c;
StringRef extractFilenamePart(StringRef filename) {
size_t lastDot = filename.size();
while (lastDot > 0 && filename[lastDot - 1] != '.') {
--lastDot;
}
}
if( isHidden ) {
tags.push_back( "." );
--lastDot;
size_t nameStart = lastDot;
while (nameStart > 0 && filename[nameStart - 1] != '/' && filename[nameStart - 1] != '\\') {
--nameStart;
}
return filename.substr(nameStart, lastDot - nameStart);
}
TestCaseInfo info( static_cast<std::string>(nameAndTags.name), _className, tags, _lineInfo );
return TestCase( _testCase, std::move(info) );
// Returns the upper bound on size of extra tags ([#file]+[.])
size_t sizeOfExtraTags(StringRef filepath) {
// [.] is 3, [#] is another 3
const size_t extras = 3 + 3;
return extractFilenamePart(filepath).size() + extras;
}
}
void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) {
std::sort(begin(tags), end(tags));
tags.erase(std::unique(begin(tags), end(tags)), end(tags));
testCaseInfo.lcaseTags.clear();
for( auto const& tag : tags ) {
std::string lcaseTag = toLower( tag );
testCaseInfo.properties = static_cast<TestCaseInfo::SpecialProperties>( testCaseInfo.properties | parseSpecialTag( lcaseTag ) );
testCaseInfo.lcaseTags.push_back( lcaseTag );
}
testCaseInfo.tags = std::move(tags);
std::unique_ptr<TestCaseInfo>
makeTestCaseInfo(std::string const& _className,
NameAndTags const& nameAndTags,
SourceLineInfo const& _lineInfo ) {
return std::make_unique<TestCaseInfo>(_className, nameAndTags, _lineInfo);
}
TestCaseInfo::TestCaseInfo( std::string const& _name,
std::string const& _className,
std::vector<std::string> const& _tags,
SourceLineInfo const& _lineInfo )
: name( _name.empty() ? makeDefaultName() : _name ),
TestCaseInfo::TestCaseInfo(std::string const& _className,
NameAndTags const& _nameAndTags,
SourceLineInfo const& _lineInfo):
name( _nameAndTags.name.empty() ? makeDefaultName() : _nameAndTags.name ),
className( _className ),
lineInfo( _lineInfo ),
properties( None )
lineInfo( _lineInfo )
{
setTags( *this, _tags );
StringRef originalTags = _nameAndTags.tags;
// We need to reserve enough space to store all of the tags
// (including optional hidden tag and filename tag)
auto requiredSize = originalTags.size() + sizeOfExtraTags(_lineInfo.file);
backingTags.reserve(requiredSize);
backingLCaseTags.reserve(requiredSize);
// We cannot copy the tags directly, as we need to normalize
// some tags, so that [.foo] is copied as [.][foo].
size_t tagStart = 0;
size_t tagEnd = 0;
bool inTag = false;
for (size_t idx = 0; idx < originalTags.size(); ++idx) {
auto c = originalTags[idx];
if (c == '[') {
assert(!inTag);
inTag = true;
tagStart = idx;
}
if (c == ']') {
assert(inTag);
inTag = false;
tagEnd = idx;
assert(tagStart < tagEnd);
// We need to check the tag for special meanings, copy
// it over to backing storage and actually reference the
// backing storage in the saved tags
StringRef tagStr = originalTags.substr(tagStart+1, tagEnd - tagStart - 1);
enforceNotReservedTag(tagStr, lineInfo);
properties |= parseSpecialTag(tagStr);
// When copying a tag to the backing storage, we need to
// check if it is a merged hide tag, such as [.foo], and
// if it is, we need to handle it as if it was [foo].
if (tagStr.size() > 1 && tagStr[0] == '.') {
tagStr = tagStr.substr(1, tagStr.size() - 1);
}
// We skip over dealing with the [.] tag, as we will add
// it later unconditionally and then sort and unique all
// the tags.
internalAppendTag(tagStr);
}
(void)inTag; // Silence "set-but-unused" warning in release mode.
}
// Add [.] if relevant
if (isHidden()) {
internalAppendTag("."_sr);
}
// Sort and prepare tags
toLowerInPlace(backingLCaseTags);
std::sort(begin(tags), end(tags), [](Tag lhs, Tag rhs) { return lhs.lowerCased < rhs.lowerCased; });
tags.erase(std::unique(begin(tags), end(tags), [](Tag lhs, Tag rhs) {return lhs.lowerCased == rhs.lowerCased; }),
end(tags));
}
bool TestCaseInfo::isHidden() const {
return ( properties & IsHidden ) != 0;
return applies( properties & TestCaseProperties::IsHidden );
}
bool TestCaseInfo::throws() const {
return ( properties & Throws ) != 0;
return applies( properties & TestCaseProperties::Throws );
}
bool TestCaseInfo::okToFail() const {
return ( properties & (ShouldFail | MayFail ) ) != 0;
return applies( properties & (TestCaseProperties::ShouldFail | TestCaseProperties::MayFail ) );
}
bool TestCaseInfo::expectedToFail() const {
return ( properties & (ShouldFail ) ) != 0;
return applies( properties & (TestCaseProperties::ShouldFail) );
}
void TestCaseInfo::addFilenameTag() {
std::string combined("#");
combined += extractFilenamePart(lineInfo.file);
internalAppendTag(combined);
}
std::string TestCaseInfo::tagsAsString() const {
@ -142,39 +200,46 @@ namespace Catch {
// '[' and ']' per tag
std::size_t full_size = 2 * tags.size();
for (const auto& tag : tags) {
full_size += tag.size();
full_size += tag.original.size();
}
ret.reserve(full_size);
for (const auto& tag : tags) {
ret.push_back('[');
ret.append(tag);
ret += tag.original;
ret.push_back(']');
}
return ret;
}
TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo&& info ) : TestCaseInfo( std::move(info) ), test( testCase ) {}
void TestCase::invoke() const {
test->invoke();
void TestCaseInfo::internalAppendTag(StringRef tagStr) {
backingTags += '[';
const auto backingStart = backingTags.size();
backingTags += tagStr;
const auto backingEnd = backingTags.size();
backingTags += ']';
backingLCaseTags += '[';
// We append the tag to the lower-case backing storage as-is,
// because we will perform the lower casing later, in bulk
backingLCaseTags += tagStr;
backingLCaseTags += ']';
tags.emplace_back(StringRef(backingTags.c_str() + backingStart, backingEnd - backingStart),
StringRef(backingLCaseTags.c_str() + backingStart, backingEnd - backingStart));
}
bool TestCase::operator == ( TestCase const& other ) const {
return test.get() == other.test.get() &&
name == other.name &&
className == other.className;
bool TestCaseHandle::operator == ( TestCaseHandle const& rhs ) const {
return m_invoker == rhs.m_invoker
&& m_info->name == rhs.m_info->name
&& m_info->className == rhs.m_info->className;
}
bool TestCase::operator < ( TestCase const& other ) const {
return name < other.name;
bool TestCaseHandle::operator < ( TestCaseHandle const& rhs ) const {
return m_info->name < rhs.m_info->name;
}
TestCaseInfo const& TestCase::getTestCaseInfo() const
{
return *this;
TestCaseInfo const& TestCaseHandle::getTestCaseInfo() const {
return *m_info;
}
} // end namespace Catch

View File

@ -9,6 +9,7 @@
#define TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED
#include "catch_common.h"
#include "catch_stringref.h"
#include "catch_test_registry.h"
#include <string>
@ -22,59 +23,74 @@
namespace Catch {
struct Tag {
Tag(StringRef original_, StringRef lowerCased_):
original(original_), lowerCased(lowerCased_)
{}
StringRef original, lowerCased;
};
struct ITestInvoker;
struct TestCaseInfo {
enum SpecialProperties{
None = 0,
IsHidden = 1 << 1,
ShouldFail = 1 << 2,
MayFail = 1 << 3,
Throws = 1 << 4,
NonPortable = 1 << 5,
Benchmark = 1 << 6
};
enum class TestCaseProperties : uint8_t {
None = 0,
IsHidden = 1 << 1,
ShouldFail = 1 << 2,
MayFail = 1 << 3,
Throws = 1 << 4,
NonPortable = 1 << 5,
Benchmark = 1 << 6
};
TestCaseInfo( std::string const& _name,
std::string const& _className,
std::vector<std::string> const& _tags,
SourceLineInfo const& _lineInfo );
friend void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags );
struct TestCaseInfo : NonCopyable {
TestCaseInfo(std::string const& _className,
NameAndTags const& _tags,
SourceLineInfo const& _lineInfo);
bool isHidden() const;
bool throws() const;
bool okToFail() const;
bool expectedToFail() const;
// Adds the tag(s) with test's filename (for the -# flag)
void addFilenameTag();
std::string tagsAsString() const;
std::string name;
std::string className;
std::vector<std::string> tags;
std::vector<std::string> lcaseTags;
private:
std::string backingTags, backingLCaseTags;
// Internally we copy tags to the backing storage and then add
// refs to this storage to the tags vector.
void internalAppendTag(StringRef tagString);
public:
std::vector<Tag> tags;
SourceLineInfo lineInfo;
SpecialProperties properties;
TestCaseProperties properties = TestCaseProperties::None;
};
class TestCase : public TestCaseInfo {
class TestCaseHandle {
TestCaseInfo* m_info;
ITestInvoker* m_invoker;
public:
TestCaseHandle(TestCaseInfo* info, ITestInvoker* invoker) :
m_info(info), m_invoker(invoker) {}
TestCase( ITestInvoker* testCase, TestCaseInfo&& info );
void invoke() const;
void invoke() const {
m_invoker->invoke();
}
TestCaseInfo const& getTestCaseInfo() const;
bool operator == ( TestCase const& other ) const;
bool operator < ( TestCase const& other ) const;
private:
std::shared_ptr<ITestInvoker> test;
bool operator== ( TestCaseHandle const& rhs ) const;
bool operator < ( TestCaseHandle const& rhs ) const;
};
TestCase makeTestCase( ITestInvoker* testCase,
std::string const& className,
std::unique_ptr<TestCaseInfo> makeTestCaseInfo( std::string const& className,
NameAndTags const& nameAndTags,
SourceLineInfo const& lineInfo );
}

View File

@ -19,9 +19,9 @@
namespace Catch {
std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ) {
std::vector<TestCase> sorted = unsortedTestCases;
std::vector<TestCaseHandle> sorted = unsortedTestCases;
switch( config.runOrder() ) {
case RunTests::InLexicographicalOrder:
@ -38,53 +38,59 @@ namespace Catch {
return sorted;
}
bool isThrowSafe( TestCase const& testCase, IConfig const& config ) {
return !testCase.throws() || config.allowThrows();
bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config ) {
return !testCase.getTestCaseInfo().throws() || config.allowThrows();
}
bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) {
return testSpec.matches( testCase ) && isThrowSafe( testCase, config );
bool matchTest( TestCaseHandle const& testCase, TestSpec const& testSpec, IConfig const& config ) {
return testSpec.matches( testCase.getTestCaseInfo() ) && isThrowSafe( testCase, config );
}
void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions ) {
std::set<TestCase> seenFunctions;
void enforceNoDuplicateTestCases( std::vector<TestCaseHandle> const& functions ) {
std::set<TestCaseHandle> seenFunctions;
for( auto const& function : functions ) {
auto prev = seenFunctions.insert( function );
CATCH_ENFORCE( prev.second,
"error: TEST_CASE( \"" << function.name << "\" ) already defined.\n"
"error: TEST_CASE( \"" << function.getTestCaseInfo().name << "\" ) already defined.\n"
<< "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n"
<< "\tRedefined at " << function.getTestCaseInfo().lineInfo );
}
}
std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
std::vector<TestCase> filtered;
std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
std::vector<TestCaseHandle> filtered;
filtered.reserve( testCases.size() );
for (auto const& testCase : testCases) {
if ((!testSpec.hasFilters() && !testCase.isHidden()) ||
if ((!testSpec.hasFilters() && !testCase.getTestCaseInfo().isHidden()) ||
(testSpec.hasFilters() && matchTest(testCase, testSpec, config))) {
filtered.push_back(testCase);
}
}
return filtered;
}
std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) {
std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ) {
return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config );
}
void TestRegistry::registerTest( TestCase const& testCase ) {
m_functions.push_back( testCase );
void TestRegistry::registerTest(std::unique_ptr<TestCaseInfo> testInfo, std::unique_ptr<ITestInvoker> testInvoker) {
m_handles.emplace_back(testInfo.get(), testInvoker.get());
m_infos.push_back(std::move(testInfo));
m_invokers.push_back(std::move(testInvoker));
}
std::vector<TestCase> const& TestRegistry::getAllTests() const {
return m_functions;
std::vector<std::unique_ptr<TestCaseInfo>> const& TestRegistry::getAllInfos() const {
return m_infos;
}
std::vector<TestCase> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const {
std::vector<TestCaseHandle> const& TestRegistry::getAllTests() const {
return m_handles;
}
std::vector<TestCaseHandle> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const {
if( m_sortedFunctions.empty() )
enforceNoDuplicateTestCases( m_functions );
enforceNoDuplicateTestCases( m_handles );
if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) {
m_sortedFunctions = sortTests( config, m_functions );
m_sortedFunctions = sortTests( config, m_handles );
m_currentSortOrder = config.runOrder();
}
return m_sortedFunctions;
@ -93,8 +99,6 @@ namespace Catch {
///////////////////////////////////////////////////////////////////////////
TestInvokerAsFunction::TestInvokerAsFunction( void(*testAsFunction)() ) noexcept : m_testAsFunction( testAsFunction ) {}
void TestInvokerAsFunction::invoke() const {
m_testAsFunction();
}

View File

@ -15,44 +15,48 @@
#include <vector>
#include <set>
#include <algorithm>
#include <ios>
namespace Catch {
class TestCase;
class TestCaseHandle;
struct IConfig;
std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases );
std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases );
bool isThrowSafe( TestCase const& testCase, IConfig const& config );
bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config );
bool matchTest( TestCaseHandle const& testCase, TestSpec const& testSpec, IConfig const& config );
void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions );
void enforceNoDuplicateTestCases( std::vector<TestCaseHandle> const& functions );
std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );
std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );
std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config );
std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config );
class TestRegistry : public ITestCaseRegistry {
public:
virtual ~TestRegistry() = default;
virtual void registerTest( TestCase const& testCase );
virtual void registerTest( std::unique_ptr<TestCaseInfo> testInfo, std::unique_ptr<ITestInvoker> testInvoker );
std::vector<TestCase> const& getAllTests() const override;
std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const override;
std::vector<std::unique_ptr<TestCaseInfo>> const& getAllInfos() const override;
std::vector<TestCaseHandle> const& getAllTests() const override;
std::vector<TestCaseHandle> const& getAllTestsSorted( IConfig const& config ) const override;
private:
std::vector<TestCase> m_functions;
std::vector<std::unique_ptr<TestCaseInfo>> m_infos;
std::vector<std::unique_ptr<ITestInvoker>> m_invokers;
std::vector<TestCaseHandle> m_handles;
mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder;
mutable std::vector<TestCase> m_sortedFunctions;
mutable std::vector<TestCaseHandle> m_sortedFunctions;
};
///////////////////////////////////////////////////////////////////////////
class TestInvokerAsFunction : public ITestInvoker {
void(*m_testAsFunction)();
class TestInvokerAsFunction final : public ITestInvoker {
using TestType = void(*)();
TestType m_testAsFunction;
public:
TestInvokerAsFunction( void(*testAsFunction)() ) noexcept;
TestInvokerAsFunction(TestType testAsFunction) noexcept:
m_testAsFunction(testAsFunction) {}
void invoke() const override;
};

View File

@ -12,19 +12,19 @@
namespace Catch {
auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* {
return new(std::nothrow) TestInvokerAsFunction( testAsFunction );
std::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ) {
return std::make_unique<TestInvokerAsFunction>( testAsFunction );
}
AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept {
AutoReg::AutoReg( std::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept {
CATCH_TRY {
getMutableRegistryHub()
.registerTest(
makeTestCase(
invoker,
makeTestCaseInfo(
extractClassName( classOrMethod ),
nameAndTags,
lineInfo));
lineInfo),
std::move(invoker));
} CATCH_CATCH_ALL {
// Do not throw when constructing global objects, instead register the exception to be processed later
getMutableRegistryHub().registerStartupException();

View File

@ -15,6 +15,8 @@
#include "catch_preprocessor.hpp"
#include "catch_meta.hpp"
#include <memory>
namespace Catch {
template<typename C>
@ -29,11 +31,11 @@ public:
}
};
auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker*;
std::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() );
template<typename C>
auto makeTestInvoker( void (C::*testAsMethod)() ) noexcept -> ITestInvoker* {
return new(std::nothrow) TestInvokerAsMethod<C>( testAsMethod );
std::unique_ptr<ITestInvoker> makeTestInvoker( void (C::*testAsMethod)() ) {
return std::make_unique<TestInvokerAsMethod<C>>( testAsMethod );
}
struct NameAndTags {
@ -45,7 +47,7 @@ struct NameAndTags {
};
struct AutoReg : NonCopyable {
AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept;
AutoReg( std::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept;
};
} // end namespace Catch

View File

@ -43,9 +43,11 @@ namespace Catch {
{}
bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const {
return std::find(begin(testCase.lcaseTags),
end(testCase.lcaseTags),
m_tag) != end(testCase.lcaseTags);
return std::find_if(begin(testCase.tags),
end(testCase.tags),
[&](Tag const& tag) {
return tag.lowerCased == m_tag;
}) != end(testCase.tags);
}
bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const {
@ -84,13 +86,13 @@ namespace Catch {
return std::any_of( m_filters.begin(), m_filters.end(), [&]( Filter const& f ){ return f.matches( testCase ); } );
}
TestSpec::Matches TestSpec::matchesByFilter( std::vector<TestCase> const& testCases, IConfig const& config ) const
TestSpec::Matches TestSpec::matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const
{
Matches matches( m_filters.size() );
std::transform( m_filters.begin(), m_filters.end(), matches.begin(), [&]( Filter const& filter ){
std::vector<TestCase const*> currentMatches;
std::vector<TestCaseHandle const*> currentMatches;
for( auto const& test : testCases )
if( isThrowSafe( test, config ) && filter.matches( test ) )
if( isThrowSafe( test, config ) && filter.matches( test.getTestCaseInfo() ) )
currentMatches.emplace_back( &test );
return FilterMatch{ filter.name(), currentMatches };
} );

View File

@ -63,14 +63,14 @@ namespace Catch {
public:
struct FilterMatch {
std::string name;
std::vector<TestCase const*> tests;
std::vector<TestCaseHandle const*> tests;
};
using Matches = std::vector<FilterMatch>;
using vectorStrings = std::vector<std::string>;
bool hasFilters() const;
bool matches( TestCaseInfo const& testCase ) const;
Matches matchesByFilter( std::vector<TestCase> const& testCases, IConfig const& config ) const;
Matches matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const;
const vectorStrings & getInvalidArgs() const;
private:

View File

@ -41,7 +41,7 @@ namespace Catch {
} else {
stream << "FAIL";
}
stream << ' ' << _testCaseStats.testInfo.name << '\n';
stream << ' ' << _testCaseStats.testInfo->name << '\n';
StreamingReporterBase::testCaseEnded( _testCaseStats );
}

View File

@ -45,7 +45,7 @@ namespace Catch {
void noMatchingTestCases(std::string const&) override {}
void reportInvalidArguments(std::string const&) override {}
void testRunStarting(TestRunInfo const& _testRunInfo) override {
currentTestRunInfo = _testRunInfo;
}
@ -55,7 +55,7 @@ namespace Catch {
}
void testCaseStarting(TestCaseInfo const& _testInfo) override {
currentTestCaseInfo = _testInfo;
currentTestCaseInfo = &_testInfo;
}
void sectionStarting(SectionInfo const& _sectionInfo) override {
m_sectionStack.push_back(_sectionInfo);
@ -65,13 +65,13 @@ namespace Catch {
m_sectionStack.pop_back();
}
void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override {
currentTestCaseInfo.reset();
currentTestCaseInfo = nullptr;
}
void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override {
currentGroupInfo.reset();
}
void testRunEnded(TestRunStats const& /* _testRunStats */) override {
currentTestCaseInfo.reset();
currentTestCaseInfo = nullptr;
currentGroupInfo.reset();
currentTestRunInfo.reset();
}
@ -86,7 +86,7 @@ namespace Catch {
LazyStat<TestRunInfo> currentTestRunInfo;
LazyStat<GroupInfo> currentGroupInfo;
LazyStat<TestCaseInfo> currentTestCaseInfo;
TestCaseInfo const* currentTestCaseInfo;
std::vector<SectionInfo> m_sectionStack;
ReporterPreferences m_reporterPrefs;
@ -261,7 +261,7 @@ namespace Catch {
// Event listeners should not use the default listing impl
void listReporters(std::vector<ReporterDescription> const&, Config const&) override {}
void listTests(std::vector<TestCase> const&, Config const&) override {}
void listTests(std::vector<TestCaseHandle> const&, Config const&) override {}
void listTags(std::vector<TagInfo> const&, Config const&) override {}
};

View File

@ -48,12 +48,17 @@ namespace Catch {
return std::string(timeStamp);
}
std::string fileNameTag(const std::vector<std::string> &tags) {
std::string fileNameTag(std::vector<Tag> const& tags) {
auto it = std::find_if(begin(tags),
end(tags),
[] (std::string const& tag) {return tag.front() == '#'; });
if (it != tags.end())
return it->substr(1);
[] (Tag const& tag) {
return tag.original.size() > 0
&& tag.original[0] == '#'; });
if (it != tags.end()) {
return static_cast<std::string>(
it->original.substr(1, it->original.size() - 1)
);
}
return std::string();
}
} // anonymous namespace
@ -159,10 +164,10 @@ namespace Catch {
assert( testCaseNode.children.size() == 1 );
SectionNode const& rootSection = *testCaseNode.children.front();
std::string className = stats.testInfo.className;
std::string className = stats.testInfo->className;
if( className.empty() ) {
className = fileNameTag(stats.testInfo.tags);
className = fileNameTag(stats.testInfo->tags);
if ( className.empty() )
className = "global";
}

View File

@ -163,7 +163,7 @@ namespace Catch {
m_reporter->listReporters(descriptions, config);
}
void ListeningReporter::listTests(std::vector<TestCase> const& tests, Config const& config) {
void ListeningReporter::listTests(std::vector<TestCaseHandle> const& tests, Config const& config) {
for (auto const& listener : m_listeners) {
listener->listTests(tests, config);
}

View File

@ -55,7 +55,7 @@ namespace Catch {
bool isMulti() const override;
void listReporters(std::vector<ReporterDescription> const& descriptions, Config const& config) override;
void listTests(std::vector<TestCase> const& tests, Config const& config) override;
void listTests(std::vector<TestCaseHandle> const& tests, Config const& config) override;
void listTags(std::vector<TagInfo> const& tags, Config const& config) override;

View File

@ -58,7 +58,7 @@ namespace Catch {
void writeGroup(TestGroupNode const& groupNode) {
std::map<std::string, TestGroupNode::ChildNodes> testsPerFile;
for(auto const& child : groupNode.children)
testsPerFile[child->value.testInfo.lineInfo.file].push_back(child);
testsPerFile[child->value.testInfo->lineInfo.file].push_back(child);
for(auto const& kv : testsPerFile)
writeTestFile(kv.first.c_str(), kv.second);
@ -77,7 +77,7 @@ namespace Catch {
// test case itself. That section may have 0-n nested sections
assert(testCaseNode.children.size() == 1);
SectionNode const& rootSection = *testCaseNode.children.front();
writeSection("", rootSection, testCaseNode.value.testInfo.okToFail());
writeSection("", rootSection, testCaseNode.value.testInfo->okToFail());
}
void writeSection(std::string const& rootName, SectionNode const& sectionNode, bool okToFail) {

View File

@ -152,16 +152,17 @@ namespace Catch {
void testCaseEnded( TestCaseStats const& testCaseStats ) override {
StreamingReporterBase::testCaseEnded( testCaseStats );
auto const& testCaseInfo = *testCaseStats.testInfo;
if( !testCaseStats.stdOut.empty() )
stream << "##teamcity[testStdOut name='"
<< escape( testCaseStats.testInfo.name )
<< escape( testCaseInfo.name )
<< "' out='" << escape( testCaseStats.stdOut ) << "']\n";
if( !testCaseStats.stdErr.empty() )
stream << "##teamcity[testStdErr name='"
<< escape( testCaseStats.testInfo.name )
<< escape(testCaseInfo.name )
<< "' out='" << escape( testCaseStats.stdErr ) << "']\n";
stream << "##teamcity[testFinished name='"
<< escape( testCaseStats.testInfo.name ) << "' duration='"
<< escape(testCaseInfo.name ) << "' duration='"
<< m_testTimer.getElapsedMilliseconds() << "']\n";
stream.flush();
}

View File

@ -277,7 +277,7 @@ namespace Catch {
}
}
void XmlReporter::listTests(std::vector<TestCase> const& tests, Config const&) {
void XmlReporter::listTests(std::vector<TestCaseHandle> const& tests, Config const&) {
auto outerTag = m_xml.scopedElement("MatchingTests");
for (auto const& test : tests) {
auto innerTag = m_xml.scopedElement("TestCase");
@ -312,7 +312,7 @@ namespace Catch {
auto aliasTag = m_xml.scopedElement("Aliases");
for (auto const& alias : tag.spellings) {
m_xml.startElement("Alias", XmlFormatting::Indent)
.writeText(alias, XmlFormatting::None)
.writeText(static_cast<std::string>(alias), XmlFormatting::None)
.endElement(XmlFormatting::Newline);
}
}

View File

@ -58,7 +58,7 @@ namespace Catch {
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
void listReporters(std::vector<ReporterDescription> const& descriptions, Config const& config) override;
void listTests(std::vector<TestCase> const& tests, Config const& config) override;
void listTests(std::vector<TestCaseHandle> const& tests, Config const& config) override;
void listTags(std::vector<TagInfo> const& tags, Config const& config) override;
private:

View File

@ -883,150 +883,150 @@ RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits>
Message.tests.cpp:<line number>: failed: explicitly with 1 message: 'Message from section one'
Message.tests.cpp:<line number>: failed: explicitly with 1 message: 'Message from section two'
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches(tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "*a" ).matches( tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "*a" ).matches( *tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "a*" ).matches( tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "a*" ).matches( *tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "*a*" ).matches( tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "*a*" ).matches( *tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( fakeTestCase( " aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( fakeTestCase( " aardvark" ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( fakeTestCase( " aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( fakeTestCase( "aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( fakeTestCase( "aardvark" ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( fakeTestCase( " aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( fakeTestCase( " aardvark" ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( fakeTestCase( " aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( fakeTestCase( "aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( fakeTestCase( "aardvark" ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark" ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark" ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark" ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark" ) ) for: true
Condition.tests.cpp:<line number>: passed: p == 0 for: 0 == 0
Condition.tests.cpp:<line number>: passed: p == pNULL for: 0 == 0
Condition.tests.cpp:<line number>: passed: p != 0 for: 0x<hex digits> != 0
@ -1051,16 +1051,16 @@ CmdLine.tests.cpp:<line number>: passed: config.reporterName == "console" for: "
CmdLine.tests.cpp:<line number>: passed: !(cfg.hasTestFilters()) for: !false
CmdLine.tests.cpp:<line number>: passed: result for: {?}
CmdLine.tests.cpp:<line number>: passed: cfg.hasTestFilters() for: true
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("notIncluded")) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("test1")) for: true
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(*fakeTestCase("notIncluded")) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(*fakeTestCase("test1")) for: true
CmdLine.tests.cpp:<line number>: passed: result for: {?}
CmdLine.tests.cpp:<line number>: passed: cfg.hasTestFilters() for: true
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("test1")) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("alwaysIncluded")) for: true
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(*fakeTestCase("test1")) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) for: true
CmdLine.tests.cpp:<line number>: passed: result for: {?}
CmdLine.tests.cpp:<line number>: passed: cfg.hasTestFilters() for: true
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("test1")) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("alwaysIncluded")) for: true
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(*fakeTestCase("test1")) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) for: true
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-r", "console"}) for: {?}
CmdLine.tests.cpp:<line number>: passed: config.reporterName == "console" for: "console" == "console"
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-r", "xml"}) for: {?}
@ -1662,7 +1662,7 @@ StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(s, "'", "|'")
StringManip.tests.cpp:<line number>: passed: s == "didn|'t" for: "didn|'t" == "didn|'t"
Misc.tests.cpp:<line number>: failed: false with 1 message: '3'
Message.tests.cpp:<line number>: failed: false with 2 messages: 'hi' and 'i := 7'
Tag.tests.cpp:<line number>: passed: testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")) for: { ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." )
Tag.tests.cpp:<line number>: passed: tags, Catch::VectorContains("magic-tag"_catch_sr) && Catch::VectorContains("."_catch_sr) for: { ., magic-tag } ( Contains: magic-tag and Contains: . )
StringManip.tests.cpp:<line number>: passed: splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { }
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) for: { abc } Equals: { abc }
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) for: { abc, def } Equals: { abc, def }

View File

@ -6418,12 +6418,12 @@ with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
@ -6440,12 +6440,12 @@ with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches(tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
@ -6462,12 +6462,12 @@ with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
@ -6484,12 +6484,12 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == true )
CHECK( spec.matches( *tcB ) == true )
with expansion:
true == true
@ -6506,12 +6506,12 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == true )
CHECK( spec.matches( *tcB ) == true )
with expansion:
true == true
@ -6528,17 +6528,17 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == true )
CHECK( spec.matches( *tcB ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == false )
CHECK( spec.matches( *tcC ) == false )
with expansion:
false == false
@ -6555,27 +6555,27 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == true )
CHECK( spec.matches( *tcC ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == false )
CHECK( spec.matches( *tcD ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( parseTestSpec( "*a" ).matches( tcA ) == true )
CHECK( parseTestSpec( "*a" ).matches( *tcA ) == true )
with expansion:
true == true
@ -6592,27 +6592,27 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == true )
CHECK( spec.matches( *tcC ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == false )
CHECK( spec.matches( *tcD ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( parseTestSpec( "a*" ).matches( tcA ) == true )
CHECK( parseTestSpec( "a*" ).matches( *tcA ) == true )
with expansion:
true == true
@ -6629,27 +6629,27 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == true )
CHECK( spec.matches( *tcC ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == true )
CHECK( spec.matches( *tcD ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( parseTestSpec( "*a*" ).matches( tcA ) == true )
CHECK( parseTestSpec( "*a*" ).matches( *tcA ) == true )
with expansion:
true == true
@ -6666,12 +6666,12 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == true )
CHECK( spec.matches( *tcA ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
@ -6688,12 +6688,12 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == true )
CHECK( spec.matches( *tcA ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
@ -6710,12 +6710,12 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == true )
CHECK( spec.matches( *tcA ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
@ -6732,22 +6732,22 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == true )
CHECK( spec.matches( *tcC ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == true )
CHECK( spec.matches( *tcD ) == true )
with expansion:
true == true
@ -6764,22 +6764,22 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == true )
CHECK( spec.matches( *tcA ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == true )
CHECK( spec.matches( *tcB ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == true )
CHECK( spec.matches( *tcC ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == true )
CHECK( spec.matches( *tcD ) == true )
with expansion:
true == true
@ -6796,17 +6796,17 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == true )
CHECK( spec.matches( *tcB ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == false )
CHECK( spec.matches( *tcC ) == false )
with expansion:
false == false
@ -6823,17 +6823,17 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == true )
CHECK( spec.matches( *tcB ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == true )
CHECK( spec.matches( *tcC ) == true )
with expansion:
true == true
@ -6850,17 +6850,17 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == true )
CHECK( spec.matches( *tcC ) == true )
with expansion:
true == true
@ -6877,17 +6877,17 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == true )
CHECK( spec.matches( *tcC ) == true )
with expansion:
true == true
@ -6904,22 +6904,22 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == true )
CHECK( spec.matches( *tcC ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == false )
CHECK( spec.matches( *tcD ) == false )
with expansion:
false == false
@ -6936,17 +6936,17 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == true )
CHECK( spec.matches( *tcA ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == false )
CHECK( spec.matches( *tcC ) == false )
with expansion:
false == false
@ -6963,17 +6963,17 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == true )
CHECK( spec.matches( *tcB ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == false )
CHECK( spec.matches( *tcC ) == false )
with expansion:
false == false
@ -6990,22 +6990,22 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == false )
CHECK( spec.matches( *tcC ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == true )
CHECK( spec.matches( *tcD ) == true )
with expansion:
true == true
@ -7022,22 +7022,22 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == false )
CHECK( spec.matches( *tcC ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == true )
CHECK( spec.matches( *tcD ) == true )
with expansion:
true == true
@ -7054,22 +7054,22 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == true )
CHECK( spec.matches( *tcA ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == false )
CHECK( spec.matches( *tcC ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == true )
CHECK( spec.matches( *tcD ) == true )
with expansion:
true == true
@ -7086,22 +7086,22 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == true )
CHECK( spec.matches( *tcA ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == true )
CHECK( spec.matches( *tcB ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == false )
CHECK( spec.matches( *tcC ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == false )
CHECK( spec.matches( *tcD ) == false )
with expansion:
false == false
@ -7118,22 +7118,22 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == true )
CHECK( spec.matches( *tcA ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == true )
CHECK( spec.matches( *tcB ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == true )
CHECK( spec.matches( *tcC ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == false )
CHECK( spec.matches( *tcD ) == false )
with expansion:
false == false
@ -7150,22 +7150,22 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == true )
CHECK( spec.matches( *tcA ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == true )
CHECK( spec.matches( *tcB ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == true )
CHECK( spec.matches( *tcC ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == false )
CHECK( spec.matches( *tcD ) == false )
with expansion:
false == false
@ -7182,22 +7182,22 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == true )
CHECK( spec.matches( *tcC ) == true )
with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == false )
CHECK( spec.matches( *tcD ) == false )
with expansion:
false == false
@ -7214,22 +7214,22 @@ with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == false )
CHECK( spec.matches( *tcC ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == false )
CHECK( spec.matches( *tcD ) == false )
with expansion:
false == false
@ -7246,22 +7246,22 @@ with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == false )
CHECK( spec.matches( *tcC ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == false )
CHECK( spec.matches( *tcD ) == false )
with expansion:
false == false
@ -7278,22 +7278,22 @@ with expansion:
true == true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcA ) == false )
CHECK( spec.matches( *tcA ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcB ) == false )
CHECK( spec.matches( *tcB ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcC ) == false )
CHECK( spec.matches( *tcC ) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( tcD ) == true )
CHECK( spec.matches( *tcD ) == true )
with expansion:
true == true
@ -7305,27 +7305,27 @@ CmdLine.tests.cpp:<line number>
...............................................................................
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( fakeTestCase( " aardvark " ) ) )
CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) )
with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( fakeTestCase( " aardvark" ) ) )
CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) )
with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( fakeTestCase( " aardvark " ) ) )
CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) )
with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( fakeTestCase( "aardvark " ) ) )
CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) )
with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( fakeTestCase( "aardvark" ) ) )
CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) )
with expansion:
true
@ -7337,27 +7337,27 @@ CmdLine.tests.cpp:<line number>
...............................................................................
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( fakeTestCase( " aardvark " ) ) )
CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) )
with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( fakeTestCase( " aardvark" ) ) )
CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) )
with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( fakeTestCase( " aardvark " ) ) )
CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) )
with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( fakeTestCase( "aardvark " ) ) )
CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) )
with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK( spec.matches( fakeTestCase( "aardvark" ) ) )
CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) )
with expansion:
true
@ -7530,12 +7530,12 @@ with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( cfg.testSpec().matches(fakeTestCase("notIncluded")) == false )
REQUIRE( cfg.testSpec().matches(*fakeTestCase("notIncluded")) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( cfg.testSpec().matches(fakeTestCase("test1")) )
REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) )
with expansion:
true
@ -7558,12 +7558,12 @@ with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( cfg.testSpec().matches(fakeTestCase("test1")) == false )
REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( cfg.testSpec().matches(fakeTestCase("alwaysIncluded")) )
REQUIRE( cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) )
with expansion:
true
@ -7586,12 +7586,12 @@ with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( cfg.testSpec().matches(fakeTestCase("test1")) == false )
REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) == false )
with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( cfg.testSpec().matches(fakeTestCase("alwaysIncluded")) )
REQUIRE( cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) )
with expansion:
true
@ -12341,9 +12341,9 @@ Tag.tests.cpp:<line number>
...............................................................................
Tag.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")) )
REQUIRE_THAT( tags, Catch::VectorContains("magic-tag"_catch_sr) && Catch::VectorContains("."_catch_sr) )
with expansion:
{ ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." )
{ ., magic-tag } ( Contains: magic-tag and Contains: . )
-------------------------------------------------------------------------------
splitString

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@
#include "catch.hpp"
#include "internal/catch_test_spec_parser.h"
#include "internal/catch_test_case_info.h"
#include "internal/catch_config.hpp"
#include "internal/catch_commandline.h"
@ -15,269 +16,271 @@
# pragma clang diagnostic ignored "-Wc++98-compat"
#endif
inline Catch::TestCase fakeTestCase(const char* name, const char* desc = "") { return Catch::makeTestCase(nullptr, "", { name, desc }, CATCH_INTERNAL_LINEINFO); }
namespace {
auto fakeTestCase(const char* name, const char* desc = "") { return Catch::makeTestCaseInfo("", { name, desc }, CATCH_INTERNAL_LINEINFO); }
}
TEST_CASE( "Parse test names and tags" ) {
using Catch::parseTestSpec;
using Catch::TestSpec;
Catch::TestCase tcA = fakeTestCase( "a" );
Catch::TestCase tcB = fakeTestCase( "b", "[one][x]" );
Catch::TestCase tcC = fakeTestCase( "longer name with spaces", "[two][three][.][x]" );
Catch::TestCase tcD = fakeTestCase( "zlonger name with spacesz" );
auto tcA = fakeTestCase( "a" );
auto tcB = fakeTestCase( "b", "[one][x]" );
auto tcC = fakeTestCase( "longer name with spaces", "[two][three][.][x]" );
auto tcD = fakeTestCase( "zlonger name with spacesz" );
SECTION( "Empty test spec should have no filters" ) {
TestSpec spec;
CHECK( spec.hasFilters() == false );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
}
SECTION( "Test spec from empty string should have no filters" ) {
TestSpec spec = parseTestSpec( "" );
CHECK( spec.hasFilters() == false );
CHECK( spec.matches(tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
}
SECTION( "Test spec from just a comma should have no filters" ) {
TestSpec spec = parseTestSpec( "," );
CHECK( spec.hasFilters() == false );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
}
SECTION( "Test spec from name should have one filter" ) {
TestSpec spec = parseTestSpec( "b" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == true );
}
SECTION( "Test spec from quoted name should have one filter" ) {
TestSpec spec = parseTestSpec( "\"b\"" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == true );
}
SECTION( "Test spec from name should have one filter" ) {
TestSpec spec = parseTestSpec( "b" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == true );
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == true );
CHECK( spec.matches( *tcC ) == false );
}
SECTION( "Wildcard at the start" ) {
TestSpec spec = parseTestSpec( "*spaces" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == true );
CHECK( spec.matches( tcD ) == false );
CHECK( parseTestSpec( "*a" ).matches( tcA ) == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == true );
CHECK( spec.matches( *tcD ) == false );
CHECK( parseTestSpec( "*a" ).matches( *tcA ) == true );
}
SECTION( "Wildcard at the end" ) {
TestSpec spec = parseTestSpec( "long*" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == true );
CHECK( spec.matches( tcD ) == false );
CHECK( parseTestSpec( "a*" ).matches( tcA ) == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == true );
CHECK( spec.matches( *tcD ) == false );
CHECK( parseTestSpec( "a*" ).matches( *tcA ) == true );
}
SECTION( "Wildcard at both ends" ) {
TestSpec spec = parseTestSpec( "*name*" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == true );
CHECK( spec.matches( tcD ) == true );
CHECK( parseTestSpec( "*a*" ).matches( tcA ) == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == true );
CHECK( spec.matches( *tcD ) == true );
CHECK( parseTestSpec( "*a*" ).matches( *tcA ) == true );
}
SECTION( "Redundant wildcard at the start" ) {
TestSpec spec = parseTestSpec( "*a" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == true );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( *tcA ) == true );
CHECK( spec.matches( *tcB ) == false );
}
SECTION( "Redundant wildcard at the end" ) {
TestSpec spec = parseTestSpec( "a*" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == true );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( *tcA ) == true );
CHECK( spec.matches( *tcB ) == false );
}
SECTION( "Redundant wildcard at both ends" ) {
TestSpec spec = parseTestSpec( "*a*" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == true );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( *tcA ) == true );
CHECK( spec.matches( *tcB ) == false );
}
SECTION( "Wildcard at both ends, redundant at start" ) {
TestSpec spec = parseTestSpec( "*longer*" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == true );
CHECK( spec.matches( tcD ) == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == true );
CHECK( spec.matches( *tcD ) == true );
}
SECTION( "Just wildcard" ) {
TestSpec spec = parseTestSpec( "*" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == true );
CHECK( spec.matches( tcB ) == true );
CHECK( spec.matches( tcC ) == true );
CHECK( spec.matches( tcD ) == true );
CHECK( spec.matches( *tcA ) == true );
CHECK( spec.matches( *tcB ) == true );
CHECK( spec.matches( *tcC ) == true );
CHECK( spec.matches( *tcD ) == true );
}
SECTION( "Single tag" ) {
TestSpec spec = parseTestSpec( "[one]" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == true );
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == true );
CHECK( spec.matches( *tcC ) == false );
}
SECTION( "Single tag, two matches" ) {
TestSpec spec = parseTestSpec( "[x]" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == true );
CHECK( spec.matches( tcC ) == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == true );
CHECK( spec.matches( *tcC ) == true );
}
SECTION( "Two tags" ) {
TestSpec spec = parseTestSpec( "[two][x]" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == true );
}
SECTION( "Two tags, spare separated" ) {
TestSpec spec = parseTestSpec( "[two] [x]" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == true );
}
SECTION( "Wildcarded name and tag" ) {
TestSpec spec = parseTestSpec( "*name*[x]" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == true );
CHECK( spec.matches( tcD ) == false );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == true );
CHECK( spec.matches( *tcD ) == false );
}
SECTION( "Single tag exclusion" ) {
TestSpec spec = parseTestSpec( "~[one]" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == true );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( *tcA ) == true );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == false );
}
SECTION( "One tag exclusion and one tag inclusion" ) {
TestSpec spec = parseTestSpec( "~[two][x]" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == true );
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == true );
CHECK( spec.matches( *tcC ) == false );
}
SECTION( "One tag exclusion and one wldcarded name inclusion" ) {
TestSpec spec = parseTestSpec( "~[two]*name*" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( tcD ) == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == false );
CHECK( spec.matches( *tcD ) == true );
}
SECTION( "One tag exclusion, using exclude:, and one wldcarded name inclusion" ) {
TestSpec spec = parseTestSpec( "exclude:[two]*name*" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( tcD ) == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == false );
CHECK( spec.matches( *tcD ) == true );
}
SECTION( "name exclusion" ) {
TestSpec spec = parseTestSpec( "~b" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == true );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( tcD ) == true );
CHECK( spec.matches( *tcA ) == true );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == false );
CHECK( spec.matches( *tcD ) == true );
}
SECTION( "wildcarded name exclusion" ) {
TestSpec spec = parseTestSpec( "~*name*" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == true );
CHECK( spec.matches( tcB ) == true );
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( tcD ) == false );
CHECK( spec.matches( *tcA ) == true );
CHECK( spec.matches( *tcB ) == true );
CHECK( spec.matches( *tcC ) == false );
CHECK( spec.matches( *tcD ) == false );
}
SECTION( "wildcarded name exclusion with tag inclusion" ) {
TestSpec spec = parseTestSpec( "~*name*,[three]" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == true );
CHECK( spec.matches( tcB ) == true );
CHECK( spec.matches( tcC ) == true );
CHECK( spec.matches( tcD ) == false );
CHECK( spec.matches( *tcA ) == true );
CHECK( spec.matches( *tcB ) == true );
CHECK( spec.matches( *tcC ) == true );
CHECK( spec.matches( *tcD ) == false );
}
SECTION( "wildcarded name exclusion, using exclude:, with tag inclusion" ) {
TestSpec spec = parseTestSpec( "exclude:*name*,[three]" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == true );
CHECK( spec.matches( tcB ) == true );
CHECK( spec.matches( tcC ) == true );
CHECK( spec.matches( tcD ) == false );
CHECK( spec.matches( *tcA ) == true );
CHECK( spec.matches( *tcB ) == true );
CHECK( spec.matches( *tcC ) == true );
CHECK( spec.matches( *tcD ) == false );
}
SECTION( "two wildcarded names" ) {
TestSpec spec = parseTestSpec( "\"longer*\"\"*spaces\"" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == true );
CHECK( spec.matches( tcD ) == false );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == true );
CHECK( spec.matches( *tcD ) == false );
}
SECTION( "empty tag" ) {
TestSpec spec = parseTestSpec( "[]" );
CHECK( spec.hasFilters() == false );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( tcD ) == false );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == false );
CHECK( spec.matches( *tcD ) == false );
}
SECTION( "empty quoted name" ) {
TestSpec spec = parseTestSpec( "\"\"" );
CHECK( spec.hasFilters() == false );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( tcD ) == false );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == false );
CHECK( spec.matches( *tcD ) == false );
}
SECTION( "quoted string followed by tag exclusion" ) {
TestSpec spec = parseTestSpec( "\"*name*\"~[.]" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( tcD ) == true );
CHECK( spec.matches( *tcA ) == false );
CHECK( spec.matches( *tcB ) == false );
CHECK( spec.matches( *tcC ) == false );
CHECK( spec.matches( *tcD ) == true );
}
SECTION( "Leading and trailing spaces in test spec" ) {
TestSpec spec = parseTestSpec( "\" aardvark \"" );
CHECK( spec.matches( fakeTestCase( " aardvark " ) ) );
CHECK( spec.matches( fakeTestCase( " aardvark" ) ) );
CHECK( spec.matches( fakeTestCase( " aardvark " ) ) );
CHECK( spec.matches( fakeTestCase( "aardvark " ) ) );
CHECK( spec.matches( fakeTestCase( "aardvark" ) ) );
CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) );
CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) );
CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) );
CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) );
CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) );
}
SECTION( "Leading and trailing spaces in test name" ) {
TestSpec spec = parseTestSpec( "aardvark" );
CHECK( spec.matches( fakeTestCase( " aardvark " ) ) );
CHECK( spec.matches( fakeTestCase( " aardvark" ) ) );
CHECK( spec.matches( fakeTestCase( " aardvark " ) ) );
CHECK( spec.matches( fakeTestCase( "aardvark " ) ) );
CHECK( spec.matches( fakeTestCase( "aardvark" ) ) );
CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) );
CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) );
CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) );
CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) );
CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) );
}
}
@ -317,8 +320,8 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
Catch::Config cfg(config);
REQUIRE(cfg.hasTestFilters());
REQUIRE(cfg.testSpec().matches(fakeTestCase("notIncluded")) == false);
REQUIRE(cfg.testSpec().matches(fakeTestCase("test1")));
REQUIRE(cfg.testSpec().matches(*fakeTestCase("notIncluded")) == false);
REQUIRE(cfg.testSpec().matches(*fakeTestCase("test1")));
}
SECTION("Specify one test case exclusion using exclude:") {
auto result = cli.parse({"test", "exclude:test1"});
@ -326,8 +329,8 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
Catch::Config cfg(config);
REQUIRE(cfg.hasTestFilters());
REQUIRE(cfg.testSpec().matches(fakeTestCase("test1")) == false);
REQUIRE(cfg.testSpec().matches(fakeTestCase("alwaysIncluded")));
REQUIRE(cfg.testSpec().matches(*fakeTestCase("test1")) == false);
REQUIRE(cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")));
}
SECTION("Specify one test case exclusion using ~") {
@ -336,8 +339,8 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
Catch::Config cfg(config);
REQUIRE(cfg.hasTestFilters());
REQUIRE(cfg.testSpec().matches(fakeTestCase("test1")) == false);
REQUIRE(cfg.testSpec().matches(fakeTestCase("alwaysIncluded")));
REQUIRE(cfg.testSpec().matches(*fakeTestCase("test1")) == false);
REQUIRE(cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")));
}
}

View File

@ -42,6 +42,12 @@ TEST_CASE( "Tag alias can be registered against tag patterns" ) {
}
TEST_CASE("shortened hide tags are split apart") {
auto testcase = Catch::makeTestCase(nullptr, "", {"fake test name", "[.magic-tag]"}, CATCH_INTERNAL_LINEINFO);
REQUIRE_THAT(testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")));
using Catch::StringRef;
auto testcase = Catch::makeTestCaseInfo("", {"fake test name", "[.magic-tag]"}, CATCH_INTERNAL_LINEINFO);
// Transform ...
std::vector<StringRef> tags;
for (auto const& tag : testcase->tags) {
tags.push_back(tag.original);
}
REQUIRE_THAT(tags, Catch::VectorContains("magic-tag"_catch_sr) && Catch::VectorContains("."_catch_sr));
}