forked from qt-creator/qt-creator
Autotest: extract cpp document lookup into cpp test parser
Change-Id: I261684206ec7ff9a97ca4a88b5846ebbc0fdda47 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -139,12 +139,10 @@ static bool handleGTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
|||||||
bool GTestParser::processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
|
bool GTestParser::processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||||
const QString &fileName)
|
const QString &fileName)
|
||||||
{
|
{
|
||||||
if (!m_cppSnapshot.contains(fileName) || !selectedForBuilding(fileName))
|
CPlusPlus::Document::Ptr doc = document(fileName);
|
||||||
|
if (doc.isNull() || !includesGTest(doc, m_cppSnapshot) || !hasGTestNames(doc))
|
||||||
return false;
|
return false;
|
||||||
CPlusPlus::Document::Ptr document = m_cppSnapshot.find(fileName).value();
|
return handleGTest(futureInterface, doc, m_cppSnapshot, id());
|
||||||
if (!includesGTest(document, m_cppSnapshot) || !hasGTestNames(document))
|
|
||||||
return false;
|
|
||||||
return handleGTest(futureInterface, document, m_cppSnapshot, id());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -78,5 +78,10 @@ void CppParser::release()
|
|||||||
m_workingCopy = CppTools::WorkingCopy();
|
m_workingCopy = CppTools::WorkingCopy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPlusPlus::Document::Ptr CppParser::document(const QString &fileName)
|
||||||
|
{
|
||||||
|
return selectedForBuilding(fileName) ? m_cppSnapshot.document(fileName) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Autotest
|
} // namespace Autotest
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ public:
|
|||||||
static QByteArray getFileContent(const QString &filePath);
|
static QByteArray getFileContent(const QString &filePath);
|
||||||
void release() override;
|
void release() override;
|
||||||
|
|
||||||
|
CPlusPlus::Document::Ptr document(const QString &fileName);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CPlusPlus::Snapshot m_cppSnapshot;
|
CPlusPlus::Snapshot m_cppSnapshot;
|
||||||
CppTools::WorkingCopy m_workingCopy;
|
CppTools::WorkingCopy m_workingCopy;
|
||||||
|
|||||||
@@ -389,9 +389,9 @@ void QtTestParser::release()
|
|||||||
bool QtTestParser::processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
|
bool QtTestParser::processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||||
const QString &fileName)
|
const QString &fileName)
|
||||||
{
|
{
|
||||||
if (!m_cppSnapshot.contains(fileName) || !selectedForBuilding(fileName))
|
CPlusPlus::Document::Ptr doc = document(fileName);
|
||||||
|
if (doc.isNull())
|
||||||
return false;
|
return false;
|
||||||
CPlusPlus::Document::Ptr doc = m_cppSnapshot.find(fileName).value();
|
|
||||||
const QString &oldName = m_testCaseNames.value(fileName);
|
const QString &oldName = m_testCaseNames.value(fileName);
|
||||||
const QStringList &alternativeFiles = m_alternativeFiles.values(fileName);
|
const QStringList &alternativeFiles = m_alternativeFiles.values(fileName);
|
||||||
if ((!includesQtTest(doc, m_cppSnapshot) || !qtTestLibDefined(fileName)) && oldName.isEmpty())
|
if ((!includesQtTest(doc, m_cppSnapshot) || !qtTestLibDefined(fileName)) && oldName.isEmpty())
|
||||||
|
|||||||
Reference in New Issue
Block a user