(self, code)
| 142 | |
| 143 | # Perform lint on single line of input and return the error message. |
| 144 | def PerformSingleLineLint(self, code): |
| 145 | error_collector = ErrorCollector(self.assertTrue) |
| 146 | lines = code.split("\n") |
| 147 | cpplint.RemoveMultiLineComments("foo.h", lines, error_collector) |
| 148 | clean_lines = cpplint.CleansedLines(lines) |
| 149 | include_state = cpplint._IncludeState() |
| 150 | function_state = cpplint._FunctionState() |
| 151 | nesting_state = cpplint.NestingState() |
| 152 | cpplint.ProcessLine( |
| 153 | "foo.cc", |
| 154 | "cc", |
| 155 | clean_lines, |
| 156 | 0, |
| 157 | include_state, |
| 158 | function_state, |
| 159 | nesting_state, |
| 160 | error_collector, |
| 161 | ) |
| 162 | # Single-line lint tests are allowed to fail the 'unlintable function' |
| 163 | # check. |
| 164 | error_collector.RemoveIfPresent("Lint failed to find start of function body.") |
| 165 | return error_collector.Results() |
| 166 | |
| 167 | # Perform lint over multiple lines and return the error message. |
| 168 | def PerformMultiLineLint(self, code): |
no test coverage detected