CppEditor/CppTools: Introduce Test{Case,Document}

Move common functionality of the 12 test classes into base classes.

Change-Id: If64d3cec876807ac6f991151189860a99b8ff4ca
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-12-16 16:02:45 +01:00
parent 5aa8a63f90
commit 5c8df5fa4e
25 changed files with 814 additions and 659 deletions

View File

@@ -27,9 +27,10 @@
**
****************************************************************************/
#include "cpptoolsplugin.h"
#include "cpppointerdeclarationformatter.h"
#include "cpptoolsplugin.h"
#include "cpptoolsplugin.h"
#include "cpptoolstestcase.h"
#include <texteditor/plaintexteditor.h>
@@ -63,8 +64,9 @@ static QString stripCursor(const QString &source)
return copy;
}
struct TestEnvironment
class TestEnvironment : public CppTools::Tests::TestCase
{
public:
QByteArray source;
Snapshot snapshot;
CppRefactoringFilePtr cppRefactoringFile;
@@ -88,9 +90,7 @@ struct TestEnvironment
// Write source to temprorary file
const QString filePath = QDir::tempPath() + QLatin1String("/file.h");
document = Document::create(filePath);
Utils::FileSaver documentSaver(document->fileName());
documentSaver.write(sourceWithoutCursorMarker.toLatin1());
documentSaver.finalize();
QVERIFY(writeFile(document->fileName(), sourceWithoutCursorMarker.toLatin1()));
// Preprocess source
Preprocessor preprocess(0, &env);