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
@@ -87,15 +87,18 @@ public:
|
||||
}
|
||||
|
||||
// Write source to temprorary file
|
||||
const QString filePath = QDir::tempPath() + QLatin1String("/file.h");
|
||||
Document::Ptr document = Document::create(filePath);
|
||||
QVERIFY(writeFile(document->fileName(), sourceWithoutCursorMarker.toUtf8()));
|
||||
Tests::TemporaryDir temporaryDir;
|
||||
QVERIFY(temporaryDir.isValid());
|
||||
const QString filePath = temporaryDir.createFile("file.h",
|
||||
sourceWithoutCursorMarker.toUtf8());
|
||||
QVERIFY(!filePath.isEmpty());
|
||||
|
||||
// Preprocess source
|
||||
Environment env;
|
||||
Preprocessor preprocess(0, &env);
|
||||
const QByteArray preprocessedSource = preprocess.run(filePath, sourceWithoutCursorMarker);
|
||||
|
||||
Document::Ptr document = Document::create(filePath);
|
||||
document->setUtf8Source(preprocessedSource);
|
||||
document->parse(parseMode);
|
||||
document->check();
|
||||
|
||||
Reference in New Issue
Block a user