forked from qt-creator/qt-creator
CppTools: Tests: Stop writing into source dir
Instead, always write into a unique temporary directory in QDir::tempPath(). Where applicable, read the test source from files instead of first writing the file. Some clean ups in test_codegen*. Change-Id: Id48dc50c6ca16252edfd9fc8a86ba0de9f9be486 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
committed by
Erik Verbruggen
parent
cb3c7538be
commit
6cafc424e8
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "cpptoolsplugin.h"
|
||||
#include "cpptoolsreuse.h"
|
||||
#include "cpptoolstestcase.h"
|
||||
#include "cppfilesettingspage.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
@@ -60,15 +61,16 @@ void CppToolsPlugin::test_headersource()
|
||||
QFETCH(QString, sourceFileName);
|
||||
QFETCH(QString, headerFileName);
|
||||
|
||||
bool wasHeader;
|
||||
const QString baseDir = baseTestDir();
|
||||
QDir path = QDir(baseDir + _(QTest::currentDataTag()));
|
||||
Tests::TemporaryDir temporaryDir;
|
||||
QVERIFY(temporaryDir.isValid());
|
||||
|
||||
const QDir path = QDir(temporaryDir.path() + QLatin1Char('/') + _(QTest::currentDataTag()));
|
||||
const QString sourcePath = path.absoluteFilePath(sourceFileName);
|
||||
const QString headerPath = path.absoluteFilePath(headerFileName);
|
||||
createTempFile(sourcePath);
|
||||
createTempFile(headerPath);
|
||||
|
||||
bool wasHeader;
|
||||
clearHeaderSourceCache();
|
||||
QCOMPARE(correspondingHeaderOrSource(sourcePath, &wasHeader), headerPath);
|
||||
QVERIFY(!wasHeader);
|
||||
|
||||
Reference in New Issue
Block a user