Processes the given gmock header file.
(gmock_header_path)
| 123 | processed_files = sets.Set() # Holds all gmock headers we've processed. |
| 124 | |
| 125 | def ProcessFile(gmock_header_path): |
| 126 | """Processes the given gmock header file.""" |
| 127 | |
| 128 | # We don't process the same header twice. |
| 129 | if gmock_header_path in processed_files: |
| 130 | return |
| 131 | |
| 132 | processed_files.add(gmock_header_path) |
| 133 | |
| 134 | # Reads each line in the given gmock header. |
| 135 | for line in file(os.path.join(gmock_root, gmock_header_path), 'r'): |
| 136 | m = INCLUDE_GMOCK_FILE_REGEX.match(line) |
| 137 | if m: |
| 138 | # It's '#include "gmock/..."' - let's process it recursively. |
| 139 | ProcessFile('include/' + m.group(1)) |
| 140 | else: |
| 141 | m = gtest.INCLUDE_GTEST_FILE_REGEX.match(line) |
| 142 | if m: |
| 143 | # It's '#include "gtest/foo.h"'. We translate it to |
| 144 | # "gtest/gtest.h", regardless of what foo is, since all |
| 145 | # gtest headers are fused into gtest/gtest.h. |
| 146 | |
| 147 | # There is no need to #include gtest.h twice. |
| 148 | if not gtest.GTEST_H_SEED in processed_files: |
| 149 | processed_files.add(gtest.GTEST_H_SEED) |
| 150 | output_file.write('#include "%s"\n' % (gtest.GTEST_H_OUTPUT,)) |
| 151 | else: |
| 152 | # Otherwise we copy the line unchanged to the output file. |
| 153 | output_file.write(line) |
| 154 | |
| 155 | ProcessFile(GMOCK_H_SEED) |
| 156 | output_file.close() |
no test coverage detected