Commit 0bd59178 authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppEditor/CppTools: Don't continue in test function on failure

QVERIFY/QCOMPARE are meant to be called in the test function so that on
failure they just can "return" and thus skip subsequent code. Since we
use reusable test code in the test functions (the *TestCase classes), we
need to ensure that on failure no further test code is executed.

This mostly inlines the run function of the test classes into the
constructor.

Change-Id: I320ee032bdde0174ddfe3fdf3f9e18e19abf1d7f
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent c7f3ac40
......@@ -62,56 +62,49 @@ typedef QByteArray _;
class DoxygenTestCase : public CppEditor::Internal::Tests::TestCase
{
public:
DoxygenTestCase(const QByteArray &input);
void run(const QByteArray &expected);
private:
CppEditor::Internal::Tests::TestDocument testDocument;
/// The '|' in the input denotes the cursor position.
DoxygenTestCase(const QByteArray &original, const QByteArray &expected)
{
QVERIFY(succeededSoFar());
CppEditor::Internal::Tests::TestDocument testDocument("file.cpp", original, '|');
QVERIFY(testDocument.hasCursorMarker());
testDocument.m_source.remove(testDocument.m_cursorPosition, 1);
QVERIFY(testDocument.writeToDisk());
// Update Code Model
QVERIFY(parseFiles(testDocument.filePath()));
// Open Editor
QVERIFY(openCppEditor(testDocument.filePath(), &testDocument.m_editor,
&testDocument.m_editorWidget));
closeEditorAtEndOfTestCase(testDocument.m_editor);
// We want to test documents that start with a comment. By default, the
// editor will fold the very first comment it encounters, assuming
// it is a license header. Currently unfoldAll() does not work as
// expected (some blocks are still hidden in some test cases, so the
// cursor movements are not as expected). For the time being, we just
// prepend a declaration before the initial test comment.
// testDocument.m_editorWidget->unfoldAll();
testDocument.m_editor->setCursorPosition(testDocument.m_cursorPosition);
waitForRehighlightedSemanticDocument(testDocument.m_editorWidget);
// Send 'ENTER' key press
QKeyEvent event(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
QCoreApplication::sendEvent(testDocument.m_editorWidget, &event);
const QByteArray result = testDocument.m_editorWidget->document()->toPlainText().toUtf8();
QCOMPARE(QLatin1String(result), QLatin1String(expected));
testDocument.m_editorWidget->undo();
const QByteArray contentsAfterUndo
= testDocument.m_editorWidget->document()->toPlainText().toUtf8();
QCOMPARE(contentsAfterUndo, testDocument.m_source);
}
};
/// The '|' in the input denotes the cursor position.
DoxygenTestCase::DoxygenTestCase(const QByteArray &input)
: testDocument("file.cpp", input, '|')
{
QVERIFY(testDocument.hasCursorMarker());
testDocument.m_source.remove(testDocument.m_cursorPosition, 1);
QVERIFY(testDocument.writeToDisk());
// Update Code Model
QVERIFY(parseFiles(testDocument.filePath()));
// Open Editor
QVERIFY(openCppEditor(testDocument.filePath(), &testDocument.m_editor,
&testDocument.m_editorWidget));
closeEditorAtEndOfTestCase(testDocument.m_editor);
// We want to test documents that start with a comment. By default, the
// editor will fold the very first comment it encounters, assuming
// it is a license header. Currently unfoldAll() does not work as
// expected (some blocks are still hidden in some test cases, so the
// cursor movements are not as expected). For the time being, we just
// prepend a declaration before the initial test comment.
// testDocument.m_editorWidget->unfoldAll();
testDocument.m_editor->setCursorPosition(testDocument.m_cursorPosition);
waitForRehighlightedSemanticDocument(testDocument.m_editorWidget);
}
void DoxygenTestCase::run(const QByteArray &expected)
{
// Send 'ENTER' key press
QKeyEvent event(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
QCoreApplication::sendEvent(testDocument.m_editorWidget, &event);
const QByteArray result = testDocument.m_editorWidget->document()->toPlainText().toUtf8();
QCOMPARE(QLatin1String(result), QLatin1String(expected));
testDocument.m_editorWidget->undo();
const QByteArray contentsAfterUndo
= testDocument.m_editorWidget->document()->toPlainText().toUtf8();
QCOMPARE(contentsAfterUndo, testDocument.m_source);
}
} // anonymous namespace
void CppEditorPlugin::test_doxygen_comments_data()
......@@ -257,6 +250,5 @@ void CppEditorPlugin::test_doxygen_comments()
{
QFETCH(QByteArray, given);
QFETCH(QByteArray, expected);
DoxygenTestCase test(given);
test.run(expected);
DoxygenTestCase(given, expected);
}
......@@ -49,8 +49,12 @@ namespace {
class IncludeHierarchyTestCase: public CppEditor::Internal::Tests::TestCase
{
public:
IncludeHierarchyTestCase(const QList<QByteArray> &sourceList)
IncludeHierarchyTestCase(const QList<QByteArray> &sourceList,
int includesCount,
int includedByCount)
{
QVERIFY(succeededSoFar());
QStringList filePaths;
const int sourceListSize = sourceList.size();
for (int i = 0; i < sourceListSize; ++i) {
......@@ -66,16 +70,14 @@ public:
// Update Code Model
QVERIFY(parseFiles(filePaths));
}
void run(int includesCount, int includedByCount)
{
// Open Editor
const QString fileName = QDir::tempPath() + QLatin1String("/file1.h");
CPPEditor *editor;
QVERIFY(openCppEditor(fileName, &editor));
closeEditorAtEndOfTestCase(editor);
// Test model
CppIncludeHierarchyModel model(0);
model.buildHierarchy(editor, fileName);
QCOMPARE(model.rowCount(model.index(0, 0)), includesCount);
......@@ -91,8 +93,7 @@ void CppEditorPlugin::test_includeHierarchyModel_simpleIncludes()
sourceList.append(QByteArray("#include \"file2.h\"\n"));
sourceList.append(QByteArray());
IncludeHierarchyTestCase testCase(sourceList);
testCase.run(1, 0);
IncludeHierarchyTestCase(sourceList, 1, 0);
}
void CppEditorPlugin::test_includeHierarchyModel_simpleIncludedBy()
......@@ -101,8 +102,7 @@ void CppEditorPlugin::test_includeHierarchyModel_simpleIncludedBy()
sourceList.append(QByteArray());
sourceList.append(QByteArray("#include \"file1.h\"\n"));
IncludeHierarchyTestCase testCase(sourceList);
testCase.run(0, 1);
IncludeHierarchyTestCase(sourceList, 0, 1);
}
void CppEditorPlugin::test_includeHierarchyModel_simpleIncludesAndIncludedBy()
......@@ -112,6 +112,5 @@ void CppEditorPlugin::test_includeHierarchyModel_simpleIncludesAndIncludedBy()
sourceList.append(QByteArray());
sourceList.append(QByteArray("#include \"file1.h\"\n"));
IncludeHierarchyTestCase testCase(sourceList);
testCase.run(1, 1);
IncludeHierarchyTestCase(sourceList, 1, 1);
}
......@@ -97,6 +97,11 @@ public:
QByteArray m_expectedSource;
};
QList<TestDocumentPtr> singleDocument(const QByteArray &original, const QByteArray &expected)
{
return QList<TestDocumentPtr>() << TestDocument::create("file.cpp", original, expected);
}
/**
* Encapsulates the whole process of setting up an editor, getting the
* quick-fix, applying it, and checking the result.
......@@ -104,19 +109,15 @@ public:
class QuickFixTestCase : public CppEditor::Internal::Tests::TestCase
{
public:
QuickFixTestCase(const QByteArray &originalSource, const QByteArray &expectedSource,
const QStringList &includePaths = QStringList());
QuickFixTestCase(const QList<TestDocumentPtr> theTestFiles,
const QStringList &includePaths = QStringList());
CppQuickFixFactory *factory,
const QStringList &includePaths = QStringList(),
int resultIndex = 0);
~QuickFixTestCase();
void run(CppQuickFixFactory *factory, int resultIndex = 0);
private:
TestDocumentPtr testFileWithCursorMarker() const;
QuickFixOperation::Ptr getFix(CppQuickFixFactory *factory, CPPEditorWidget *editorWidget,
int resultIndex = 0);
void init(const QStringList &includePaths);
private:
QList<TestDocumentPtr> m_testFiles;
......@@ -139,29 +140,38 @@ QuickFixOperation::Ptr QuickFixTestCase::getFix(CppQuickFixFactory *factory,
return results.isEmpty() ? QuickFixOperation::Ptr() : results.at(resultIndex);
}
/// The '@' in the originalSource is the position from where the quick-fix discovery is triggered.
QuickFixTestCase::QuickFixTestCase(const QByteArray &originalSource,
const QByteArray &expectedSource,
const QStringList &includePaths)
: m_cppCodeStylePreferences(0)
, m_restoreIncludePaths(false)
/// Leading whitespace is not removed, so we can check if the indetation ranges
/// have been set correctly by the quick-fix.
QByteArray &removeTrailingWhitespace(QByteArray &input)
{
m_testFiles << TestDocument::create("file.cpp", originalSource, expectedSource);
init(includePaths);
QList<QByteArray> lines = input.split('\n');
input.resize(0);
foreach (QByteArray line, lines) {
while (line.length() > 0) {
char lastChar = line[line.length() - 1];
if (lastChar == ' ' || lastChar == '\t')
line = line.left(line.length() - 1);
else
break;
}
input.append(line);
input.append('\n');
}
return input;
}
/// The '@' in the originalSource is the position from where the quick-fix discovery is triggered.
/// Exactly one TestFile must contain the cursor position marker '@' in the originalSource.
QuickFixTestCase::QuickFixTestCase(const QList<TestDocumentPtr> theTestFiles,
const QStringList &includePaths)
CppQuickFixFactory *factory,
const QStringList &includePaths,
int resultIndex)
: m_testFiles(theTestFiles)
, m_cppCodeStylePreferences(0)
, m_restoreIncludePaths(false)
{
init(includePaths);
}
QVERIFY(succeededSoFar());
void QuickFixTestCase::init(const QStringList &includePaths)
{
// Check if there is exactly one cursor marker
unsigned cursorMarkersCount = 0;
foreach (const TestDocumentPtr testFile, m_testFiles) {
......@@ -208,45 +218,7 @@ void QuickFixTestCase::init(const QStringList &includePaths)
QVERIFY(m_cppCodeStylePreferences);
m_cppCodeStylePreferencesOriginalDelegateId = m_cppCodeStylePreferences->currentDelegateId();
m_cppCodeStylePreferences->setCurrentDelegate("qt");
}
QuickFixTestCase::~QuickFixTestCase()
{
// Restore default cpp code style
if (m_cppCodeStylePreferences)
m_cppCodeStylePreferences->setCurrentDelegate(m_cppCodeStylePreferencesOriginalDelegateId);
// Restore include paths
if (m_restoreIncludePaths)
m_modelManager->setIncludePaths(m_includePathsToRestore);
// Remove created files from file system
foreach (const TestDocumentPtr &testDocument, m_testFiles)
QVERIFY(QFile::remove(testDocument->filePath()));
}
/// Leading whitespace is not removed, so we can check if the indetation ranges
/// have been set correctly by the quick-fix.
QByteArray &removeTrailingWhitespace(QByteArray &input)
{
QList<QByteArray> lines = input.split('\n');
input.resize(0);
foreach (QByteArray line, lines) {
while (line.length() > 0) {
char lastChar = line[line.length() - 1];
if (lastChar == ' ' || lastChar == '\t')
line = line.left(line.length() - 1);
else
break;
}
input.append(line);
input.append('\n');
}
return input;
}
void QuickFixTestCase::run(CppQuickFixFactory *factory, int resultIndex)
{
// Run the fix in the file having the cursor marker
TestDocumentPtr testFile;
foreach (const TestDocumentPtr file, m_testFiles) {
......@@ -275,6 +247,21 @@ void QuickFixTestCase::run(CppQuickFixFactory *factory, int resultIndex)
}
}
QuickFixTestCase::~QuickFixTestCase()
{
// Restore default cpp code style
if (m_cppCodeStylePreferences)
m_cppCodeStylePreferences->setCurrentDelegate(m_cppCodeStylePreferencesOriginalDelegateId);
// Restore include paths
if (m_restoreIncludePaths)
m_modelManager->setIncludePaths(m_includePathsToRestore);
// Remove created files from file system
foreach (const TestDocumentPtr &testDocument, m_testFiles)
QVERIFY(QFile::remove(testDocument->filePath()));
}
/// Delegates directly to AddIncludeForUndefinedIdentifierOp for easier testing.
class AddIncludeForUndefinedIdentifierTestFactory : public CppQuickFixFactory
{
......@@ -1200,8 +1187,7 @@ void CppEditorPlugin::test_quickfix()
if (expected.isEmpty())
expected = original + '\n';
QuickFixTestCase test(original, expected);
test.run(factory.data());
QuickFixTestCase(singleDocument(original, expected), factory.data());
}
/// Checks: In addition to test_quickfix_GenerateGetterSetter_basicGetterWithPrefix
......@@ -1254,8 +1240,7 @@ void CppEditorPlugin::test_quickfix_GenerateGetterSetter_basicGetterWithPrefixAn
testFiles << TestDocument::create("file.cpp", original, expected);
GenerateGetterSetter factory;
QuickFixTestCase test(testFiles);
test.run(&factory);
QuickFixTestCase(testFiles, &factory);
}
/// Check if definition is inserted right after class for insert definition outside
......@@ -1298,8 +1283,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_afterClass()
testFiles << TestDocument::create("file.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase test(testFiles);
test.run(&factory, 1);
QuickFixTestCase(testFiles, &factory, QStringList(), 1);
}
/// Check from header file: If there is a source file, insert the definition in the source file.
......@@ -1332,8 +1316,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_headerSource_basic1()
testFiles << TestDocument::create("file.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase test(testFiles);
test.run(&factory);
QuickFixTestCase(testFiles, &factory);
}
/// Check from header file: If there is a source file, insert the definition in the source file.
......@@ -1371,8 +1354,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_headerSource_basic2()
testFiles << TestDocument::create("file.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase test(testFiles);
test.run(&factory);
QuickFixTestCase(testFiles, &factory);
}
/// Check from source file: Insert in source file, not header file.
......@@ -1403,8 +1385,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_headerSource_basic3()
testFiles << TestDocument::create("file.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase test(testFiles);
test.run(&factory);
QuickFixTestCase(testFiles, &factory);
}
/// Check from header file: If the class is in a namespace, the added function definition
......@@ -1439,8 +1420,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_headerSource_namespace1()
testFiles << TestDocument::create("file.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase test(testFiles);
test.run(&factory);
QuickFixTestCase(testFiles, &factory);
}
/// Check from header file: If the class is in namespace N and the source file has a
......@@ -1479,8 +1459,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_headerSource_namespace2()
testFiles << TestDocument::create("file.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase test(testFiles);
test.run(&factory);
QuickFixTestCase(testFiles, &factory);
}
/// Check definition insert inside class
......@@ -1498,8 +1477,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_insideClass()
"};\n";
InsertDefFromDecl factory;
QuickFixTestCase test(original, expected);
test.run(&factory, 1);
QuickFixTestCase(singleDocument(original, expected), &factory, QStringList(), 1);
}
/// Check not triggering when definition exists
......@@ -1513,8 +1491,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_notTriggeringWhenDefinitio
const QByteArray expected = original + "\n";
InsertDefFromDecl factory;
QuickFixTestCase test(original, expected);
test.run(&factory, 1);
QuickFixTestCase test(singleDocument(original, expected), &factory, QStringList(), 1);
}
/// Find right implementation file.
......@@ -1565,8 +1542,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_findRightImplementationFil
testFiles << TestDocument::create("file2.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase test(testFiles);
test.run(&factory);
QuickFixTestCase(testFiles, &factory);
}
/// Ignore generated functions declarations when looking at the surrounding
......@@ -1622,8 +1598,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_ignoreSurroundingGenerated
testFiles << TestDocument::create("file2.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase test(testFiles);
test.run(&factory);
QuickFixTestCase(testFiles, &factory);
}
/// Check if whitespace is respected for operator functions
......@@ -1648,8 +1623,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_respectWsInOperatorNames1(
"\n";
InsertDefFromDecl factory;
QuickFixTestCase test(original, expected);
test.run(&factory);
QuickFixTestCase(singleDocument(original, expected), &factory);
}
/// Check if whitespace is respected for operator functions
......@@ -1674,8 +1648,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_respectWsInOperatorNames2(
"\n";
InsertDefFromDecl factory;
QuickFixTestCase test(original, expected);
test.run(&factory);
QuickFixTestCase(singleDocument(original, expected), &factory);
}
/// Check if a function like macro use is not separated by the function to insert
......@@ -1718,8 +1691,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_macroUsesAtEndOfFile1()
testFiles << TestDocument::create("file.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase test(testFiles);
test.run(&factory);
QuickFixTestCase(testFiles, &factory);
}
/// Check if a function like macro use is not separated by the function to insert
......@@ -1760,8 +1732,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_macroUsesAtEndOfFile2()
testFiles << TestDocument::create("file.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase test(testFiles);
test.run(&factory);
QuickFixTestCase(testFiles, &factory);
}
/// Check if insertion happens before syntactically erroneous statements at end of file.
......@@ -1799,8 +1770,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_erroneousStatementAtEndOfF
testFiles << TestDocument::create("file.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase test(testFiles);
test.run(&factory);
QuickFixTestCase(testFiles, &factory);
}
/// Check: Respect rvalue references
......@@ -1829,8 +1799,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_rvalueReference()
testFiles << TestDocument::create("file.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixTestCase test(testFiles);
test.run(&factory);
QuickFixTestCase(testFiles, &factory);
}
// Function for one of InsertDeclDef section cases
......@@ -1867,8 +1836,7 @@ void insertToSectionDeclFromDef(const QByteArray &section, int sectionIndex)
testFiles << TestDocument::create("file.cpp", original, expected);
InsertDeclFromDef factory;
QuickFixTestCase test(testFiles);
test.run(&factory, sectionIndex);
QuickFixTestCase(testFiles, &factory, QStringList(), sectionIndex);
}
/// Check from source file: Insert in header file.
......@@ -2076,8 +2044,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_normal()
// Do not use the test factory, at least once we want to go through the "full stack".
AddIncludeForUndefinedIdentifier factory;
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: Ignore *.moc includes
......@@ -2103,8 +2070,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_ignoremoc()
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: Insert include at top for a sorted group
......@@ -2130,8 +2096,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_sortingTop(
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: Insert include in the middle for a sorted group
......@@ -2157,8 +2122,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_sortingMidd
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: Insert include at bottom for a sorted group
......@@ -2184,8 +2148,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_sortingBott
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: For an unsorted group the new include is appended
......@@ -2211,8 +2174,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_appendToUns
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: Insert a local include at front if there are only global includes
......@@ -2239,8 +2201,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_firstLocalI
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: Insert a global include at back if there are only local includes
......@@ -2270,8 +2231,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_firstGlobal
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("<file.h>"));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: Prefer group with longest matching prefix
......@@ -2301,8 +2261,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_preferGroup
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"prefixc.h\""));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: Create a new include group if there are only include groups with a different include dir
......@@ -2329,8 +2288,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_newGroupIfO
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"file.h\""));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: Include group with mixed include dirs, sorted --> insert properly
......@@ -2358,8 +2316,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_mixedDirsSo
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("<firstlib/file.h>"));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: Include group with mixed include dirs, unsorted --> append
......@@ -2387,8 +2344,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_mixedDirsUn
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("<lastlib/file.h>"));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: Include group with mixed include types
......@@ -2414,8 +2370,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_mixedInclud
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"z.h\""));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));
}
/// Check: Include group with mixed include types
......@@ -2441,8 +2396,7 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_mixedInclud
+ "/file.cpp", original, expected);
AddIncludeForUndefinedIdentifierTestFactory factory(QLatin1String("\"a.h\""));
QuickFixTestCase test(testFiles, QStringList(TestIncludePaths::globalIncludePath()));
test.run(&factory);
QuickFixTestCase(testFiles, &factory, QStringList(TestIncludePaths::globalIncludePath()));