forked from qt-creator/qt-creator
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:
committed by
Orgad Shaneh
parent
4c07887318
commit
dc8dab3d01
@@ -241,6 +241,7 @@ QuickFixOperationTest::QuickFixOperationTest(const QList<QuickFixTestDocument::P
|
||||
QuickFixOperations operations;
|
||||
factory->match(quickFixInterface, operations);
|
||||
if (operations.isEmpty()) {
|
||||
QEXPECT_FAIL("onBaseOfQualifiedClassName", "QTCREATORBUG-14499", Continue);
|
||||
QVERIFY(testDocuments.first()->m_expectedSource.isEmpty());
|
||||
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
|
||||
original = "namespace N { template <typename T> class Foo {}; }\n";
|
||||
expected = original;
|
||||
|
Reference in New Issue
Block a user