forked from qt-creator/qt-creator
CppEditor: Fix InsertDefFromDecl to find right implementation file
Task-number: QTCREATORBUG-10728 Change-Id: Ic321f7504b55e7bd7badb5262f4d7cc4552ab1fa Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
1442c88338
commit
88309188c1
@@ -1764,6 +1764,46 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_rvalueReference()
|
||||
QuickFixTestCase(testFiles, &factory);
|
||||
}
|
||||
|
||||
/// Find right implementation file. (QTCREATORBUG-10728)
|
||||
void CppEditorPlugin::test_quickfix_InsertDefFromDecl_findImplementationFile()
|
||||
{
|
||||
QList<QuickFixTestDocument::Ptr> testFiles;
|
||||
|
||||
QByteArray original;
|
||||
QByteArray expected;
|
||||
|
||||
// Header File
|
||||
original =
|
||||
"class Foo {\n"
|
||||
" void bar();\n"
|
||||
" void ba@z();\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"void Foo::bar()\n"
|
||||
"{}\n";
|
||||
expected = original + "\n";
|
||||
testFiles << QuickFixTestDocument::create("file.h", original, expected);
|
||||
|
||||
// Source File
|
||||
original =
|
||||
"#include \"file.h\"\n"
|
||||
;
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"void Foo::baz()\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
;
|
||||
testFiles << QuickFixTestDocument::create("file.cpp", original, expected);
|
||||
|
||||
InsertDefFromDecl factory;
|
||||
QuickFixTestCase(testFiles, &factory);
|
||||
}
|
||||
|
||||
// Function for one of InsertDeclDef section cases
|
||||
void insertToSectionDeclFromDef(const QByteArray §ion, int sectionIndex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user