mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	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:
		@@ -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" );
 | 
			
		||||
 
 | 
			
		||||
@@ -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 );
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user