(self, code, filename="foo.h", io=codecs)
| 219 | return error_collector.Results() |
| 220 | |
| 221 | def PerformIncludeWhatYouUse(self, code, filename="foo.h", io=codecs): |
| 222 | # First, build up the include state. |
| 223 | error_collector = ErrorCollector(self.assertTrue) |
| 224 | include_state = cpplint._IncludeState() |
| 225 | nesting_state = cpplint.NestingState() |
| 226 | lines = code.split("\n") |
| 227 | cpplint.RemoveMultiLineComments(filename, lines, error_collector) |
| 228 | lines = cpplint.CleansedLines(lines) |
| 229 | for i in range(lines.NumLines()): |
| 230 | cpplint.CheckLanguage( |
| 231 | filename, lines, i, ".h", include_state, nesting_state, error_collector |
| 232 | ) |
| 233 | # We could clear the error_collector here, but this should |
| 234 | # also be fine, since our IncludeWhatYouUse unittests do not |
| 235 | # have language problems. |
| 236 | |
| 237 | # Second, look for missing includes. |
| 238 | cpplint.CheckForIncludeWhatYouUse(filename, lines, include_state, error_collector, io) |
| 239 | return error_collector.Results() |
| 240 | |
| 241 | # Perform lint and make sure one of the errors is what we want |
| 242 | def TestLintContains(self, code, expected_message): |
no test coverage detected