Commit 48d1e8eb authored by Nikolai Kosjar's avatar Nikolai Kosjar Committed by David Schulz
Browse files

CppTools: Tests: Fix leaving test file around



Change-Id: I232194e2693a8024ff67945cbc70049e52b9ef5d
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent dc108bc3
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include <cplusplus/CppDocument.h> #include <cplusplus/CppDocument.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <QFile>
#include <QFileInfo>
#include <QtTest> #include <QtTest>
using namespace CPlusPlus; using namespace CPlusPlus;
...@@ -57,6 +59,9 @@ public: ...@@ -57,6 +59,9 @@ public:
{ {
const QString fileName = TestIncludePaths::directoryOfTestFile() const QString fileName = TestIncludePaths::directoryOfTestFile()
+ QLatin1String("/file.cpp"); + QLatin1String("/file.cpp");
if (QFileInfo(fileName).exists())
return Document::Ptr(); // Test file was not removed.
Utils::FileSaver srcSaver(fileName); Utils::FileSaver srcSaver(fileName);
srcSaver.write(source); srcSaver.write(source);
srcSaver.finalize(); srcSaver.finalize();
...@@ -65,7 +70,9 @@ public: ...@@ -65,7 +70,9 @@ public:
pp.setIncludePaths(QStringList(TestIncludePaths::directoryOfTestFile())); pp.setIncludePaths(QStringList(TestIncludePaths::directoryOfTestFile()));
pp.run(fileName); pp.run(fileName);
return m_cmm->snapshot().document(fileName); Document::Ptr document = m_cmm->snapshot().document(fileName);
QFile(fileName).remove();
return document;
} }
~SourcePreprocessor() ~SourcePreprocessor()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment