CppEditor: Add a failing test for add include for static function

Task-number: QTCREATORBUG-14499
Change-Id: I21d4281a01028d8c4cd5462d64da6428133219a4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-08-20 14:36:32 +03:00
committed by Orgad Shaneh
parent 4c07887318
commit dc8dab3d01

View File

@@ -241,6 +241,7 @@ QuickFixOperationTest::QuickFixOperationTest(const QList<QuickFixTestDocument::P
QuickFixOperations operations; QuickFixOperations operations;
factory->match(quickFixInterface, operations); factory->match(quickFixInterface, operations);
if (operations.isEmpty()) { if (operations.isEmpty()) {
QEXPECT_FAIL("onBaseOfQualifiedClassName", "QTCREATORBUG-14499", Continue);
QVERIFY(testDocuments.first()->m_expectedSource.isEmpty()); QVERIFY(testDocuments.first()->m_expectedSource.isEmpty());
return; return;
} }
@@ -2751,6 +2752,37 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_data()
// ------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------
// Header File
original = "class Foo { static void bar() {} };\n";
expected = original;
testDocuments << QuickFixTestDocument::create("afile.h", original, expected);
// Source File
original =
"#include \"header.h\"\n"
"\n"
"void f()\n"
"{\n"
" @Foo::bar();\n"
"}\n"
;
expected =
"#include \"afile.h\"\n"
"#include \"header.h\"\n"
"\n"
"void f()\n"
"{\n"
" Foo::bar();\n"
"}\n"
;
testDocuments << QuickFixTestDocument::create("afile.cpp", original, expected);
QTest::newRow("onBaseOfQualifiedClassName")
<< TestIncludePaths::globalIncludePath()
<< testDocuments << firstRefactoringOperation << "";
testDocuments.clear();
// -------------------------------------------------------------------------------------------
// Header File // Header File
original = "namespace N { template <typename T> class Foo {}; }\n"; original = "namespace N { template <typename T> class Foo {}; }\n";
expected = original; expected = original;