aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp')
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp76
1 files changed, 72 insertions, 4 deletions
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index 8bbb010422e..7532b77e8dc 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -935,6 +935,16 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_data()
"void Foo::foo(int) {}\n"
);
+ QTest::newRow("matchFunctionSignature_Follow_3.5") << _(
+ "void foo(int);\n"
+ "void @$foo() {}\n"
+ );
+
+ QTest::newRow("matchFunctionSignature_Follow_3.6") << _(
+ "void foo(int);\n"
+ "void @$foo(double) {}\n"
+ );
+
QTest::newRow("matchFunctionSignature_Follow_4") << _(
"class Foo {\n"
" void foo(int);\n"
@@ -963,17 +973,33 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_data()
"void Foo::@foo(int) {}\n"
);
- QTest::newRow("matchFunctionSignature_Follow_8") << _(
+ QTest::newRow("matchFunctionSignature_Follow_8_fuzzy") << _(
"class Foo {\n"
- " void @$foo(int *);\n"
+ " void @foo(int *);\n"
+ "};\n"
+ "void Foo::$foo(const int *) {}\n"
+ );
+
+ QTest::newRow("matchFunctionSignature_Follow_8_exact") << _(
+ "class Foo {\n"
+ " void @foo(int *);\n"
"};\n"
"void Foo::foo(const int *) {}\n"
+ "void Foo::$foo(int *) {}\n"
);
- QTest::newRow("matchFunctionSignature_Follow_9") << _(
+ QTest::newRow("matchFunctionSignature_Follow_9_fuzzy") << _(
"class Foo {\n"
- " void @$foo(int&);\n"
+ " void @foo(int&);\n"
"};\n"
+ "void Foo::$foo(const int&) {}\n"
+ );
+
+ QTest::newRow("matchFunctionSignature_Follow_9_exact") << _(
+ "class Foo {\n"
+ " void @foo(int&);\n"
+ "};\n"
+ "void Foo::$foo(int&) {}\n"
"void Foo::foo(const int&) {}\n"
);
@@ -1171,6 +1197,48 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_multipleDocuments_data()
"foo.cpp")
);
+ QTest::newRow("matchFunctionSignatureFuzzy1Forward") << (QList<TestDocumentPtr>()
+ << TestDocument::create("class Foo {\n"
+ " void @foo(int);\n"
+ " void foo();\n"
+ "};\n",
+ "foo.h")
+ << TestDocument::create("#include \"foo.h\"\n"
+ "void Foo::$foo() {}\n",
+ "foo.cpp")
+ );
+
+ QTest::newRow("matchFunctionSignatureFuzzy1Backward") << (QList<TestDocumentPtr>()
+ << TestDocument::create("class Foo {\n"
+ " void $foo(int);\n"
+ "};\n",
+ "foo.h")
+ << TestDocument::create("#include \"foo.h\"\n"
+ "void Foo::@foo() {}\n",
+ "foo.cpp")
+ );
+
+ QTest::newRow("matchFunctionSignatureFuzzy2Forward") << (QList<TestDocumentPtr>()
+ << TestDocument::create("class Foo {\n"
+ " void foo(int);\n"
+ " void @foo();\n"
+ "};\n",
+ "foo.h")
+ << TestDocument::create("#include \"foo.h\"\n"
+ "void Foo::$foo(int) {}\n",
+ "foo.cpp")
+ );
+
+ QTest::newRow("matchFunctionSignatureFuzzy2Backward") << (QList<TestDocumentPtr>()
+ << TestDocument::create("class Foo {\n"
+ " void $foo();\n"
+ "};\n",
+ "foo.h")
+ << TestDocument::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(