Find a replaceable CHECK-like macro. Args: line: line to search on. Returns: (macro name, start position), or (None, -1) if no replaceable macro is found.
(line)
| 5275 | |
| 5276 | |
| 5277 | def FindCheckMacro(line): |
| 5278 | """Find a replaceable CHECK-like macro. |
| 5279 | |
| 5280 | Args: |
| 5281 | line: line to search on. |
| 5282 | Returns: |
| 5283 | (macro name, start position), or (None, -1) if no replaceable |
| 5284 | macro is found. |
| 5285 | """ |
| 5286 | for macro in _CHECK_MACROS: |
| 5287 | i = line.find(macro) |
| 5288 | if i >= 0: |
| 5289 | # Find opening parenthesis. Do a regular expression match here |
| 5290 | # to make sure that we are matching the expected CHECK macro, as |
| 5291 | # opposed to some other macro that happens to contain the CHECK |
| 5292 | # substring. |
| 5293 | matched = re.match(r"^(.*\b" + macro + r"\s*)\(", line) |
| 5294 | if not matched: |
| 5295 | continue |
| 5296 | return (macro, len(matched.group(1))) |
| 5297 | return (None, -1) |
| 5298 | |
| 5299 | |
| 5300 | def CheckCheck(filename, clean_lines, linenum, error): |
no test coverage detected
searching dependent graphs…