forked from qt-creator/qt-creator
AutoTest: Separate different test code parsers.
Change-Id: I7ff68be6e5442f7140d1257c7d9057434a398359 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -40,6 +40,10 @@ namespace Core {
|
||||
class Id;
|
||||
}
|
||||
|
||||
namespace CppTools {
|
||||
class CppModelManager;
|
||||
}
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
@@ -88,6 +92,53 @@ public:
|
||||
|
||||
using TestParseResultPtr = QSharedPointer<TestParseResult>;
|
||||
|
||||
class ITestParser
|
||||
{
|
||||
public:
|
||||
virtual ~ITestParser() { }
|
||||
virtual void init(const QStringList &filesToParse) = 0;
|
||||
virtual bool processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
const QString &fileName) = 0;
|
||||
};
|
||||
|
||||
class CppParser : public ITestParser
|
||||
{
|
||||
public:
|
||||
void init(const QStringList &filesToParse) override;
|
||||
static bool selectedForBuilding(const QString &fileName);
|
||||
|
||||
protected:
|
||||
CPlusPlus::Snapshot m_cppSnapshot;
|
||||
};
|
||||
|
||||
class QtTestParser : public CppParser
|
||||
{
|
||||
public:
|
||||
void init(const QStringList &filesToParse) override;
|
||||
bool processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
const QString &fileName) override;
|
||||
|
||||
private:
|
||||
QHash<QString, QString> m_testCaseNames;
|
||||
};
|
||||
|
||||
class QuickTestParser : public CppParser
|
||||
{
|
||||
public:
|
||||
void init(const QStringList &filesToParse) override;
|
||||
bool processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
const QString &fileName) override;
|
||||
private:
|
||||
QmlJS::Snapshot m_qmlSnapshot;
|
||||
};
|
||||
|
||||
class GoogleTestParser : public CppParser
|
||||
{
|
||||
public:
|
||||
bool processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
const QString &fileName) override;
|
||||
};
|
||||
|
||||
class TestCodeParser : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -144,6 +195,7 @@ private:
|
||||
QSet<QString> m_postponedFiles;
|
||||
State m_parserState;
|
||||
QFutureWatcher<TestParseResultPtr> m_futureWatcher;
|
||||
QVector<ITestParser *> m_testCodeParsers;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user