(self, contents)
| 95 | return re.sub(SKIP_COMMENTS_REGEX, _replacer, text) |
| 96 | |
| 97 | def parse(self, contents): |
| 98 | TEST_FUNC_REGEX = r"^(void\s+(test_%s__(\w+))\s*\(\s*void\s*\))\s*\{" |
| 99 | |
| 100 | contents = self._skip_comments(contents) |
| 101 | regex = re.compile(TEST_FUNC_REGEX % self.name, re.MULTILINE) |
| 102 | |
| 103 | self.callbacks = [] |
| 104 | self.initializers = [] |
| 105 | self.cleanup = None |
| 106 | |
| 107 | for (declaration, symbol, short_name) in regex.findall(contents): |
| 108 | data = { |
| 109 | "short_name" : short_name, |
| 110 | "declaration" : declaration, |
| 111 | "symbol" : symbol |
| 112 | } |
| 113 | |
| 114 | if short_name.startswith('initialize'): |
| 115 | self.initializers.append(data) |
| 116 | elif short_name == 'cleanup': |
| 117 | self.cleanup = data |
| 118 | else: |
| 119 | self.callbacks.append(data) |
| 120 | |
| 121 | return self.callbacks != [] |
| 122 | |
| 123 | def refresh(self, path): |
| 124 | self.modified = False |
no test coverage detected