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

Method testChildDiagnostics

plugins/clang/tests/test_problems.cpp:134–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134void TestProblems::testChildDiagnostics()
135{
136 // expected:
137 // test.cpp:3:14: error: call to 'foo' is ambiguous
138 // int main() { foo(0); }
139 // ^~~
140 // test.cpp:1:6: note: candidate function
141 // void foo(unsigned int);
142 // ^
143 // test.cpp:2:6: note: candidate function
144 // void foo(const char*);
145 // ^
146 const QByteArray code = "void foo(unsigned int);\n"
147 "void foo(const char*);\n"
148 "int main() { foo(0); }";
149 auto problems = parse(code);
150 QCOMPARE(problems.size(), 1);
151 auto range = problems[0]->rangeInCurrentRevision();
152 QCOMPARE(range.start(), KTextEditor::Cursor(2, 13));
153 QCOMPARE(range.end(), KTextEditor::Cursor(2, 16));
154 QCOMPARE(problems[0]->diagnostics().size(), 2);
155 IProblem::Ptr p1 = problems[0]->diagnostics()[0];
156 const ProblemPointer d1 = ProblemPointer(dynamic_cast<Problem*>(p1.data()));
157 QCOMPARE(d1->url().str(), FileName);
158 QCOMPARE(d1->rangeInCurrentRevision(), KTextEditor::Range(0, 5, 0, 8));
159 IProblem::Ptr p2 = problems[0]->diagnostics()[1];
160 const ProblemPointer d2 = ProblemPointer(dynamic_cast<Problem*>(p2.data()));
161 QCOMPARE(d2->url().str(), FileName);
162 QCOMPARE(d2->rangeInCurrentRevision(), KTextEditor::Range(1, 5, 1, 8));
163}
164
165Q_DECLARE_METATYPE(QVector<ClangFixit>)
166

Callers

nothing calls this directly

Calls 11

strMethod · 0.80
parseFunction · 0.70
CursorClass · 0.50
RangeClass · 0.50
sizeMethod · 0.45
startMethod · 0.45
endMethod · 0.45
diagnosticsMethod · 0.45
dataMethod · 0.45
urlMethod · 0.45

Tested by

no test coverage detected