aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2021-08-27 13:15:46 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2021-08-30 08:21:57 +0000
commit5fe3ead73ef730fa1659bd17af206ec94a428159 (patch)
tree39be30dcb1b4509a6e6fa44ec3f4e935b73659dd /src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
parent2d994620d1c6de5c2ba085ba50d28be27e27a1fb (diff)
CppTools/CppEditor: Rename the TestDocument classes
It was not helpful that we had four different classes with the same name. Note that they look suspiciously similar and could possibly be merged into a single class at some point. Change-Id: I7d4c10a09408226037bc0d276940bca39dc5f576 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp')
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index 1472c11bf1..fd25211090 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -192,8 +192,8 @@ private:
CppEditorWidget *m_editorWidget;
};
-class TestDocument;
-typedef QSharedPointer<TestDocument> TestDocumentPtr;
+class FollowSymbolTestDocument;
+typedef QSharedPointer<FollowSymbolTestDocument> TestDocumentPtr;
/**
* Represents a test document.
@@ -202,11 +202,11 @@ typedef QSharedPointer<TestDocument> TestDocumentPtr;
* - a '@' character denotes the initial text cursor position
* - a '$' character denotes the target text cursor position
*/
-class TestDocument : public Tests::TestDocument
+class FollowSymbolTestDocument : public Tests::GenericCppTestDocument
{
public:
- TestDocument(const QByteArray &source, const QByteArray &fileName)
- : Tests::TestDocument(fileName, source)
+ FollowSymbolTestDocument(const QByteArray &source, const QByteArray &fileName)
+ : Tests::GenericCppTestDocument(fileName, source)
, m_targetCursorPosition(m_source.indexOf(QLatin1Char('$')))
{
if (m_cursorPosition != -1 || m_targetCursorPosition != -1)
@@ -229,7 +229,7 @@ public:
static TestDocumentPtr create(const QByteArray &source, const QByteArray &fileName)
{
- return TestDocumentPtr(new TestDocument(source, fileName));
+ return TestDocumentPtr(new FollowSymbolTestDocument(source, fileName));
}
bool hasTargetCursorMarker() const { return m_targetCursorPosition != -1; }
@@ -240,7 +240,7 @@ public:
QList<TestDocumentPtr> singleDocument(const QByteArray &source)
{
- return QList<TestDocumentPtr>() << TestDocument::create(source, "file.cpp");
+ return QList<TestDocumentPtr>() << FollowSymbolTestDocument::create(source, "file.cpp");
}
/**
@@ -340,7 +340,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
} projectCloser;
if (useClangd) {
- TestDocument projectFile(projectFileContent.toUtf8(), "project.qbs");
+ FollowSymbolTestDocument projectFile(projectFileContent.toUtf8(), "project.qbs");
projectFile.setBaseDirectory(temporaryDir.path());
QVERIFY(projectFile.writeToDisk());
const auto openProjectResult =
@@ -870,8 +870,8 @@ void FollowSymbolTest::testSwitchMethodDeclDef()
QFETCH(QByteArray, source);
const QList<TestDocumentPtr> testFiles = QList<TestDocumentPtr>()
- << TestDocument::create(header, "file.h")
- << TestDocument::create(source, "file.cpp");
+ << FollowSymbolTestDocument::create(header, "file.h")
+ << FollowSymbolTestDocument::create(source, "file.cpp");
F2TestCase(F2TestCase::SwitchBetweenMethodDeclarationDefinitionAction, testFiles);
}
@@ -1444,87 +1444,87 @@ void FollowSymbolTest::testFollowSymbolMultipleDocuments_data()
QTest::addColumn<QList<TestDocumentPtr> >("documents");
QTest::newRow("skipForwardDeclarationBasic") << (QList<TestDocumentPtr>()
- << TestDocument::create("class $Foo {};\n",
+ << FollowSymbolTestDocument::create("class $Foo {};\n",
"defined.h")
- << TestDocument::create("class Foo;\n"
+ << FollowSymbolTestDocument::create("class Foo;\n"
"@Foo foo;\n",
"forwardDeclaredAndUsed.h")
);
QTest::newRow("skipForwardDeclarationTemplates") << (QList<TestDocumentPtr>()
- << TestDocument::create("template <class E> class $Container {};\n",
+ << FollowSymbolTestDocument::create("template <class E> class $Container {};\n",
"defined.h")
- << TestDocument::create("template <class E> class Container;\n"
+ << FollowSymbolTestDocument::create("template <class E> class Container;\n"
"@Container<int> container;\n",
"forwardDeclaredAndUsed.h")
);
QTest::newRow("matchFunctionSignature") << (QList<TestDocumentPtr>()
- << TestDocument::create("class Foo {\n"
+ << FollowSymbolTestDocument::create("class Foo {\n"
" void @foo(int);\n"
" void foo() {}\n"
"};\n",
"foo.h")
- << TestDocument::create("#include \"foo.h\"\n"
+ << FollowSymbolTestDocument::create("#include \"foo.h\"\n"
"void Foo::$foo(int) {}\n",
"foo.cpp")
);
QTest::newRow("matchFunctionSignature2") << (QList<TestDocumentPtr>()
- << TestDocument::create("namespace N { class C; }\n"
+ << FollowSymbolTestDocument::create("namespace N { class C; }\n"
"bool *@fun(N::C *) const;\n",
"foo.h")
- << TestDocument::create("#include \"foo.h\"\n"
+ << FollowSymbolTestDocument::create("#include \"foo.h\"\n"
"using namespace N;\n"
"bool *$fun(C *) const {}\n",
"foo.cpp")
);
QTest::newRow("matchFunctionSignatureFuzzy1Forward") << (QList<TestDocumentPtr>()
- << TestDocument::create("class Foo {\n"
+ << FollowSymbolTestDocument::create("class Foo {\n"
" void @foo(int);\n"
" void foo();\n"
"};\n",
"foo.h")
- << TestDocument::create("#include \"foo.h\"\n"
+ << FollowSymbolTestDocument::create("#include \"foo.h\"\n"
"void Foo::$foo() {}\n",
"foo.cpp")
);
QTest::newRow("matchFunctionSignatureFuzzy1Backward") << (QList<TestDocumentPtr>()
- << TestDocument::create("class Foo {\n"
+ << FollowSymbolTestDocument::create("class Foo {\n"
" void $foo(int);\n"
"};\n",
"foo.h")
- << TestDocument::create("#include \"foo.h\"\n"
+ << FollowSymbolTestDocument::create("#include \"foo.h\"\n"
"void Foo::@foo() {}\n",
"foo.cpp")
);
QTest::newRow("matchFunctionSignatureFuzzy2Forward") << (QList<TestDocumentPtr>()
- << TestDocument::create("class Foo {\n"
+ << FollowSymbolTestDocument::create("class Foo {\n"
" void foo(int);\n"
" void @foo();\n"
"};\n",
"foo.h")
- << TestDocument::create("#include \"foo.h\"\n"
+ << FollowSymbolTestDocument::create("#include \"foo.h\"\n"
"void Foo::$foo(int) {}\n",
"foo.cpp")
);
QTest::newRow("matchFunctionSignatureFuzzy2Backward") << (QList<TestDocumentPtr>()
- << TestDocument::create("class Foo {\n"
+ << FollowSymbolTestDocument::create("class Foo {\n"
" void $foo();\n"
"};\n",
"foo.h")
- << TestDocument::create("#include \"foo.h\"\n"
+ << FollowSymbolTestDocument::create("#include \"foo.h\"\n"
"void Foo::@foo(int) {}\n",
"foo.cpp")
);
QTest::newRow("globalVar") << QList<TestDocumentPtr>{
- TestDocument::create("namespace NS { extern int @globalVar; }\n", "file.h"),
- TestDocument::create(
+ FollowSymbolTestDocument::create("namespace NS { extern int @globalVar; }\n", "file.h"),
+ FollowSymbolTestDocument::create(
"int globalVar;\n"
"namespace NS {\n"
"extern int globalVar;\n"
@@ -1532,7 +1532,7 @@ void FollowSymbolTest::testFollowSymbolMultipleDocuments_data()
"}\n", "file.cpp")};
QTest::newRow("staticMemberVar") << QList<TestDocumentPtr>{
- TestDocument::create(
+ FollowSymbolTestDocument::create(
"namespace NS {\n"
"class Test {\n"
" static int @var;\n"
@@ -1540,7 +1540,7 @@ void FollowSymbolTest::testFollowSymbolMultipleDocuments_data()
"class OtherClass { static int var; };\n"
"}\n"
"class OtherClass { static int var; };\n", "file.h"),
- TestDocument::create(
+ FollowSymbolTestDocument::create(
"#include \"file.h\"\n"
"int var;\n"
"int OtherClass::var;\n"
@@ -2063,12 +2063,12 @@ void FollowSymbolTest::testFollowVirtualFunctionCall()
void FollowSymbolTest::testFollowVirtualFunctionCallMultipleDocuments()
{
QList<TestDocumentPtr> testFiles = QList<TestDocumentPtr>()
- << TestDocument::create("struct A { virtual void virt(int) = 0; };\n",
+ << FollowSymbolTestDocument::create("struct A { virtual void virt(int) = 0; };\n",
"a.h")
- << TestDocument::create("#include \"a.h\"\n"
+ << FollowSymbolTestDocument::create("#include \"a.h\"\n"
"struct B : A { void virt(int) {} };\n",
"b.h")
- << TestDocument::create("#include \"a.h\"\n"
+ << FollowSymbolTestDocument::create("#include \"a.h\"\n"
"void f(A *o) { o->$@virt(42); }\n",
"u.cpp")
;