CppEditor: Be more strict about quickfixes that were not triggered

in tests

Change-Id: I1f4b4c7a1f4068a83d385e74d75a482b5effdb0c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-01-28 22:55:17 +02:00
committed by Orgad Shaneh
parent d2b5136a50
commit 6728741702
2 changed files with 4 additions and 17 deletions

View File

@@ -1406,16 +1406,7 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_data()
"public:\n" "public:\n"
" virtual int virtualFuncA() = 0;\n" " virtual int virtualFuncA() = 0;\n"
"};\n" "};\n"
) << _( ) << _();
"class BaseA {\n"
"public:\n"
" virtual int virtualFuncA();\n"
"};\n\n"
"class Derived : public Bas@eA {\n"
"public:\n"
" virtual int virtualFuncA() = 0;\n"
"};\n"
);
// Check: One pure, one not // Check: One pure, one not
QTest::newRow("Some_Pure") QTest::newRow("Some_Pure")

View File

@@ -215,7 +215,7 @@ QuickFixOperationTest::QuickFixOperationTest(const QList<QuickFixTestDocument::P
TextEditor::QuickFixOperations operations; TextEditor::QuickFixOperations operations;
factory->match(quickFixInterface, operations); factory->match(quickFixInterface, operations);
if (operations.isEmpty()) { if (operations.isEmpty()) {
qDebug() << "Quickfix was not triggered"; QVERIFY(testDocuments.first()->m_expectedSource.isEmpty());
return; return;
} }
@@ -1296,7 +1296,7 @@ void CppEditorPlugin::test_quickfix_data()
QTest::newRow("OptimizeForLoop_wrongInitializer") QTest::newRow("OptimizeForLoop_wrongInitializer")
<< CppQuickFixFactoryPtr(new OptimizeForLoop) << CppQuickFixFactoryPtr(new OptimizeForLoop)
<< _("int i; void foo() {f@or (double a = 0; i < 3 + 5; ++i) {}}\n") << _("int i; void foo() {f@or (double a = 0; i < 3 + 5; ++i) {}}\n")
<< _("int i; void foo() {f@or (double a = 0; i < 3 + 5; ++i) {}}\n"); << _();
// Check: No trigger when numeric // Check: No trigger when numeric
QTest::newRow("OptimizeForLoop_noTriggerNumeric1") QTest::newRow("OptimizeForLoop_noTriggerNumeric1")
@@ -1601,8 +1601,6 @@ void CppEditorPlugin::test_quickfix()
QFETCH(QByteArray, original); QFETCH(QByteArray, original);
QFETCH(QByteArray, expected); QFETCH(QByteArray, expected);
if (expected.isEmpty())
expected = original;
QuickFixOperationTest(singleDocument(original, expected), factory.data()); QuickFixOperationTest(singleDocument(original, expected), factory.data());
} }
@@ -1900,11 +1898,9 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_notTriggeringWhenDefinitio
" void b@ar();\n" " void b@ar();\n"
"};\n" "};\n"
"void Foo::bar() {}\n"; "void Foo::bar() {}\n";
const QByteArray expected = original;
InsertDefFromDecl factory; InsertDefFromDecl factory;
QuickFixOperationTest(singleDocument(original, expected), &factory, ProjectPart::HeaderPaths(), QuickFixOperationTest(singleDocument(original, ""), &factory, ProjectPart::HeaderPaths(), 1);
1);
} }
/// Find right implementation file. /// Find right implementation file.