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