ITracker::parent returns pointer not reference

We were already using it mostly to get pointers rather than
references, so this makes it make more sense.
This commit is contained in:
Martin Hořeňovský 2021-06-09 22:01:49 +02:00
parent 4ce8a23edd
commit a14d67cace
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
3 changed files with 7 additions and 7 deletions

View File

@ -50,7 +50,7 @@ namespace Catch {
// without it, the code above creates 5 nested generators.
if ( currentTracker.nameAndLocation() == nameAndLocation ) {
auto thisTracker =
currentTracker.parent().findChild( nameAndLocation );
currentTracker.parent()->findChild( nameAndLocation );
assert( thisTracker );
assert( thisTracker->isGeneratorTracker() );
tracker = static_cast<GeneratorTracker*>( thisTracker );
@ -110,7 +110,7 @@ namespace Catch {
// This is safe: there is always at least one section
// tracker in a test case tracking tree
while ( !parent->isSectionTracker() ) {
parent = &( parent->parent() );
parent = parent->parent();
}
assert( parent &&
"Missing root (test case) level section" );

View File

@ -99,9 +99,9 @@ namespace TestCaseTracking {
return m_runState != NotStarted && !isComplete();
}
ITracker& TrackerBase::parent() {
ITracker* TrackerBase::parent() {
assert( m_parent ); // Should always be non-null except for root
return *m_parent;
return m_parent;
}
void TrackerBase::openChild() {
@ -176,7 +176,7 @@ namespace TestCaseTracking {
{
if( parent ) {
while( !parent->isSectionTracker() )
parent = &parent->parent();
parent = parent->parent();
SectionTracker& parentSection = static_cast<SectionTracker&>( *parent );
addNextFilters( parentSection.m_filters );

View File

@ -60,7 +60,7 @@ namespace TestCaseTracking {
virtual bool isOpen() const = 0; // Started but not complete
virtual bool hasStarted() const = 0;
virtual ITracker& parent() = 0;
virtual ITracker* parent() = 0;
// actions
virtual void close() = 0; // Successfully complete
@ -138,7 +138,7 @@ namespace TestCaseTracking {
return m_runState != NotStarted;
}
ITracker& parent() override;
ITracker* parent() override;
void openChild() override;