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

Method testFind

plugins/grepview/tests/test_findreplace.cpp:101–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void FindReplaceTest::testFind()
102{
103 QFETCH(QString, subject);
104 QFETCH(QRegExp, search);
105 QFETCH(MatchList, matches);
106
107 QTemporaryFile file;
108 QVERIFY(file.open());
109 file.write(subject.toUtf8());
110 file.close();
111
112 GrepOutputItem::List actualMatches = grepFile(file.fileName(), search);
113
114 QCOMPARE(actualMatches.length(), matches.length());
115
116 for(int i=0; i<matches.length(); i++)
117 {
118 QCOMPARE(actualMatches[i].change()->m_range.start().line(), matches[i].line);
119 QCOMPARE(actualMatches[i].change()->m_range.start().column(), matches[i].start);
120 QCOMPARE(actualMatches[i].change()->m_range.end().column(), matches[i].end);
121 }
122
123 // check that file has not been altered by grepFile
124 QVERIFY(file.open());
125 QCOMPARE(QString(file.readAll()), subject);
126}
127
128void FindReplaceTest::testSingleFileAsDirectoryChoice()
129{

Callers

nothing calls this directly

Calls 12

grepFileFunction · 0.85
changeMethod · 0.80
QStringClass · 0.50
openMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45
fileNameMethod · 0.45
lengthMethod · 0.45
lineMethod · 0.45
startMethod · 0.45
columnMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected