MCPcopy Create free account
hub / github.com/KDE/kdevelop / testFuzzyMatching_data

Method testFuzzyMatching_data

kdevplatform/util/tests/test_formattinghelpers.cpp:38–638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38void TestFormattingHelpers::testFuzzyMatching_data()
39{
40 QTest::addColumn<QString>("formattedMergedText");
41 QTest::addColumn<QString>("selectedText");
42 QTest::addColumn<QString>("leftContext");
43 QTest::addColumn<QString>("rightContext");
44 QTest::addColumn<QString>("expectedOutput");
45
46 QString selectedText = QStringLiteral("void bar() {\nint x;\n}");
47 QString expectedOutput = QStringLiteral("void bar() {\n int x;\n}");
48
49 QTest::newRow("left-indentation-fixed")
50 << QStringLiteral("void foo() {\n int i;\n int j;\n}\n\nvoid bar() {\n int x;\n}")
51 << selectedText
52 << QStringLiteral("void foo() {\nint i;\n\n\nint j;\n}\n\n")
53 << QStringLiteral("")
54 << expectedOutput;
55
56 QTest::newRow("right-indentation-fixed")
57 << QStringLiteral("void bar() {\n int x;\n}\n\nvoid foo() {\n int i;\n int j;\n}")
58 << selectedText
59 << QStringLiteral("")
60 << QStringLiteral("\n\nvoid foo() {\nint i;\n\n\nint j;\n}")
61 << expectedOutput;
62
63 // clang-format can break long comments into multiple lines, adding new "//".
64 // For the sake of readability, the comments in the test are actually not very long.
65 QTest::newRow("left-comment-break-fixed")
66 << QStringLiteral("void foo() {\n // very\n // long\n}\n\nvoid bar() {\n int x;\n}")
67 << selectedText
68 << QStringLiteral("void foo() {\n// very long\n}\n\n")
69 << QStringLiteral("")
70 << expectedOutput;
71
72 QTest::newRow("right-comment-break-fixed")
73 << QStringLiteral("void bar() {\n int x;\n}\n\nvoid foo() {\n // very\n // long\n}")
74 << selectedText
75 << QStringLiteral("")
76 << QStringLiteral("\n\nvoid foo() {\n// very long\n}")
77 << expectedOutput;
78
79 QTest::newRow("left-multilinecomment-break-fixed")
80 << QStringLiteral("void foo() {\n /* very\n * long */\n}\n\nvoid bar() {\n int x;\n}")
81 << selectedText
82 << QStringLiteral("void foo() {\n/* very long */\n}\n\n")
83 << QStringLiteral("")
84 << expectedOutput;
85
86 QTest::newRow("right-multilinecomment-break-fixed")
87 << QStringLiteral("void bar() {\n int x;\n}\n\nvoid foo() {\n /* very\n * long */\n}")
88 << selectedText
89 << QStringLiteral("")
90 << QStringLiteral("\n\nvoid foo() {\n/* very long */\n}")
91 << expectedOutput;
92
93 // clang-format can break long macros and add (or remove) "\"
94 QTest::newRow("left-macro-break-removed")
95 << QStringLiteral("#define foo(a,b) a = b\n\nvoid bar() {\n int x;\n}")

Callers

nothing calls this directly

Calls 9

midMethod · 0.80
QStringClass · 0.50
replaceMethod · 0.45
push_backMethod · 0.45
removeMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
swapMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected