forked from catchorg/Catch2
Check for infinite generators before we construct generator's tracker
This commit is contained in:
@@ -485,6 +485,12 @@ namespace Catch {
|
||||
SourceLineInfo lineInfo,
|
||||
Generators::GeneratorBasePtr&& generator ) {
|
||||
|
||||
if ( m_config->warnAboutInfiniteGenerators() &&
|
||||
!generator->isFinite() ) {
|
||||
// TBD: Would it be better to expand this macro inline?
|
||||
FAIL( "GENERATE() would run infinitely" );
|
||||
}
|
||||
|
||||
auto nameAndLoc = TestCaseTracking::NameAndLocation( static_cast<std::string>( generatorName ), lineInfo );
|
||||
auto& currentTracker = m_trackerContext.currentTracker();
|
||||
assert(
|
||||
@@ -497,11 +503,6 @@ namespace Catch {
|
||||
currentTracker.addChild( CATCH_MOVE( newTracker ) );
|
||||
|
||||
ret->setGenerator( CATCH_MOVE( generator ) );
|
||||
if ( m_config->warnAboutInfiniteGenerators() &&
|
||||
!ret->getGenerator()->isFinite() ) {
|
||||
// TBD: Would it be better to expand this macro inline?
|
||||
FAIL( "GENERATE() would run infinitely" );
|
||||
}
|
||||
ret->open();
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user