mirror of
https://github.com/catchorg/Catch2.git
synced 2025-06-02 18:07:59 +00:00
Integrated new section tracker.
- also pass extra section to reporter - one for each test case - ignore it in headers (this is so we know a test case has restarted) - significant effect on regression test due to change of ordering of sections - fixes infinite loop issue
This commit is contained in:
parent
6a484fdb02
commit
9aff9aa328
8 changed files with 2474 additions and 244 deletions
|
@ -57,6 +57,9 @@ namespace SectionTracking {
|
|||
TrackedSection* getParent() {
|
||||
return m_parent;
|
||||
}
|
||||
bool hasChildren() const {
|
||||
return !m_children.empty();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
|
@ -98,6 +101,9 @@ namespace SectionTracking {
|
|||
m_completedASectionThisRun = true;
|
||||
}
|
||||
|
||||
bool currentSectinHasChildren() const {
|
||||
return m_currentSection->hasChildren();
|
||||
}
|
||||
|
||||
private:
|
||||
TrackedSection* m_currentSection;
|
||||
|
@ -109,11 +115,11 @@ namespace SectionTracking {
|
|||
|
||||
TestCaseTracker( std::string const& testCaseName )
|
||||
: m_testCase( testCaseName, NULL ),
|
||||
sections( m_testCase )
|
||||
m_sections( m_testCase )
|
||||
{}
|
||||
|
||||
void enter() {
|
||||
sections = SectionTracker( m_testCase );
|
||||
m_sections = SectionTracker( m_testCase );
|
||||
m_testCase.enter();
|
||||
}
|
||||
void leave() {
|
||||
|
@ -121,19 +127,23 @@ namespace SectionTracking {
|
|||
}
|
||||
|
||||
bool enterSection( std::string const& name ) {
|
||||
return sections.enterSection( name );
|
||||
return m_sections.enterSection( name );
|
||||
}
|
||||
void leaveSection() {
|
||||
sections.leaveSection();
|
||||
m_sections.leaveSection();
|
||||
}
|
||||
|
||||
bool isCompleted() const {
|
||||
return m_testCase.runState() == TrackedSection::Completed;
|
||||
}
|
||||
|
||||
bool currentSectionHasChildren() const {
|
||||
return m_sections.currentSectinHasChildren();
|
||||
}
|
||||
|
||||
private:
|
||||
TrackedSection m_testCase;
|
||||
SectionTracker sections;
|
||||
SectionTracker m_sections;
|
||||
};
|
||||
|
||||
} // namespace SectionTracking
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue