summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2014-12-09 18:42:15 +0100
committerErik Verbruggen <erik.verbruggen@theqtcompany.com>2014-12-19 10:29:16 +0100
commit6cafc424e837aa64ecfad3828fb840d08b747452 (patch)
tree4b48d06bb2ba0117481944393f82b0f99b67d806 /src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp
parentcb3c7538be3f5ddb26f48b5dfce23bd3ea6daacc (diff)
downloadqt-creator-6cafc424e837aa64ecfad3828fb840d08b747452.tar.gz
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>
Diffstat (limited to 'src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp')
-rw-r--r--src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp b/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp
index 7ab12f77a2..9ac573c38d 100644
--- a/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp
+++ b/src/plugins/cpptools/cpppointerdeclarationformatter_test.cpp
@@ -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();