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

Method printLines

kdevplatform/debugger/tests/test_breakpointmodel.cpp:147–174  ·  view source on GitHub ↗

Print sections of example code. Used for checking what edited text looks like when writing tests.

Source from the content-addressed store, hash-verified

145/// Print sections of example code.
146/// Used for checking what edited text looks like when writing tests.
147void TestBreakpointModel::printLines(int from, int count, const IDocument* doc)
148{
149 // gather a set of breakpoint line numbers in doc.
150 std::vector<int> breakpointLines;
151 const auto breakpoints = breakpointModel()->breakpoints();
152 for (const auto* b : breakpoints) {
153 if (b->url() == doc->url()) {
154 breakpointLines.push_back(b->line());
155 }
156 }
157 std::sort(breakpointLines.begin(), breakpointLines.end());
158
159 // gather a set of breakpoint marks in doc.
160 const auto markLines = documentMarks(doc);
161
162 // Breakpoint prefixes:
163 // "[bm]" ok: a line has both mark and breakpoint instance
164 // "[b-]" a line has breakpoint instance but no mark in UI
165 // "[-m]" a line has mark in UI but no breakpoint instance
166 // TODO: print upper-case letters for marks or breakpoints that are in an enabled state.
167 for (int i = from; i < from + count && i < doc->textDocument()->lines(); ++i) {
168 const bool hasBreakpoint = std::binary_search(breakpointLines.cbegin(), breakpointLines.cend(), i);
169 QString prefix = (hasBreakpoint ? "b" : "-");
170 prefix += (markLines.contains(i) ? "m" : "-");
171
172 qDebug("%d\t[%s]: %s", i, qUtf8Printable(prefix), qUtf8Printable(doc->textDocument()->line(i)));
173 }
174}
175
176/// Verify that the breakpoint is set correctly at the expected line number,
177/// that the document line tracking is enabled for it, and that its mark type matches the expected value.

Callers

nothing calls this directly

Calls 11

breakpointModelFunction · 0.85
sortFunction · 0.85
breakpointsMethod · 0.45
urlMethod · 0.45
push_backMethod · 0.45
lineMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
linesMethod · 0.45
textDocumentMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected