| 99 | } |
| 100 | |
| 101 | void 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 | |
| 128 | void FindReplaceTest::testSingleFileAsDirectoryChoice() |
| 129 | { |
nothing calls this directly
no test coverage detected