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)
| 4600 | |
| 4601 | |
| 4602 | def FindCheckMacro(line): |
| 4603 | """Find a replaceable CHECK-like macro. |
| 4604 | |
| 4605 | Args: |
| 4606 | line: line to search on. |
| 4607 | Returns: |
| 4608 | (macro name, start position), or (None, -1) if no replaceable |
| 4609 | macro is found. |
| 4610 | """ |
| 4611 | for macro in _CHECK_MACROS: |
| 4612 | i = line.find(macro) |
| 4613 | if i >= 0: |
| 4614 | # Find opening parenthesis. Do a regular expression match here |
| 4615 | # to make sure that we are matching the expected CHECK macro, as |
| 4616 | # opposed to some other macro that happens to contain the CHECK |
| 4617 | # substring. |
| 4618 | matched = Match(r'^(.*\b' + macro + r'\s*)\(', line) |
| 4619 | if not matched: |
| 4620 | continue |
| 4621 | return (macro, len(matched.group(1))) |
| 4622 | return (None, -1) |
| 4623 | |
| 4624 | |
| 4625 | def CheckCheck(filename, clean_lines, linenum, error): |
no test coverage detected