| 29 | |
| 30 | namespace { |
| 31 | QString applyFormatting(const QString& path, bool expectedFormattingResult) |
| 32 | { |
| 33 | KDevFormatFile formatFile(path, path); |
| 34 | if (!formatFile.find()) { |
| 35 | return "found no format_sources file for " + path; |
| 36 | } |
| 37 | if (!formatFile.read()) { |
| 38 | return "reading format_sources file failed for " + path; |
| 39 | } |
| 40 | if (formatFile.apply() != expectedFormattingResult) { |
| 41 | if (expectedFormattingResult) { |
| 42 | return "formatting was expected to succeed but actually failed for " + path; |
| 43 | } else { |
| 44 | return "formatting was expected to fail but actually succeeded for " + path; |
| 45 | } |
| 46 | } |
| 47 | return QString{}; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | TestKdevFormatSource::TestKdevFormatSource() |
no test coverage detected