mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-24 13:39:24 +00:00
Purge deprecated generators
This commit is contained in:
parent
47c8994a61
commit
1e16be0b9e
11 changed files with 7 additions and 404 deletions
|
@ -18,11 +18,6 @@ namespace Catch {
|
|||
|
||||
class Context : public IMutableContext, NonCopyable {
|
||||
|
||||
public:
|
||||
virtual ~Context() {
|
||||
deleteAllValues( m_generatorsByTestName );
|
||||
}
|
||||
|
||||
public: // IContext
|
||||
virtual IResultCapture* getResultCapture() {
|
||||
return m_resultCapture;
|
||||
|
@ -30,15 +25,6 @@ namespace Catch {
|
|||
virtual IRunner* getRunner() {
|
||||
return m_runner;
|
||||
}
|
||||
virtual size_t getGeneratorIndex( std::string const& fileInfo, size_t totalSize ) {
|
||||
return getGeneratorsForCurrentTest()
|
||||
.getGeneratorInfo( fileInfo, totalSize )
|
||||
.getCurrentIndex();
|
||||
}
|
||||
virtual bool advanceGeneratorsForCurrentTest() {
|
||||
IGeneratorsForTest* generators = findGeneratorsForCurrentTest();
|
||||
return generators && generators->moveNext();
|
||||
}
|
||||
|
||||
virtual IConfigPtr getConfig() const {
|
||||
return m_config;
|
||||
|
@ -58,31 +44,11 @@ namespace Catch {
|
|||
friend IMutableContext& getCurrentMutableContext();
|
||||
|
||||
private:
|
||||
IGeneratorsForTest* findGeneratorsForCurrentTest() {
|
||||
std::string testName = getResultCapture()->getCurrentTestName();
|
||||
|
||||
std::map<std::string, IGeneratorsForTest*>::const_iterator it =
|
||||
m_generatorsByTestName.find( testName );
|
||||
return it != m_generatorsByTestName.end()
|
||||
? it->second
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
IGeneratorsForTest& getGeneratorsForCurrentTest() {
|
||||
IGeneratorsForTest* generators = findGeneratorsForCurrentTest();
|
||||
if( !generators ) {
|
||||
std::string testName = getResultCapture()->getCurrentTestName();
|
||||
generators = createGeneratorsForTest();
|
||||
m_generatorsByTestName.insert( std::make_pair( testName, generators ) );
|
||||
}
|
||||
return *generators;
|
||||
}
|
||||
|
||||
private:
|
||||
IConfigPtr m_config;
|
||||
IRunner* m_runner = nullptr;
|
||||
IResultCapture* m_resultCapture = nullptr;
|
||||
std::map<std::string, IGeneratorsForTest*> m_generatorsByTestName;
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue