diff options
author | Sergio Martins <smartins@kde.org> | 2019-05-04 16:30:00 +0100 |
---|---|---|
committer | Sergio Martins <sergio.martins@kdab.com> | 2019-05-05 18:19:23 +0100 |
commit | a95d6e93bdf7f6d70de6c53a0c2d698a6a104269 (patch) | |
tree | 09c44054191667b55fff0ee494d1a3609a5b0197 | |
parent | c971a035dcdca15fd461d7bff98151bbcc73619b (diff) |
tests: Also test fixits there were introduced in headers
-rwxr-xr-x | tests/run_tests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/run_tests.py b/tests/run_tests.py index 50c3967b..09fe9d2d 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -453,15 +453,23 @@ def patch_fixit_yaml_file(test): f.close() f = open(test.yamlFilename(), 'w') + possible_headerfile = test.relativeFilename().replace(".cpp", ".h") + for line in lines: stripped = line.strip() if stripped.startswith('MainSourceFile') or stripped.startswith("FilePath") or stripped.startswith("- FilePath"): line = line.replace(test.relativeFilename(), test.fixedFilename()) + + # Some tests also apply fix their to their headers: + line = line.replace(possible_headerfile, test.fixedFilename().replace(".cpp", ".h")) f.write(line) f.close() shutil.copyfile(test.relativeFilename(), test.fixedFilename()) + if os.path.exists(possible_headerfile): + shutil.copyfile(possible_headerfile, test.fixedFilename().replace(".cpp", ".h")) + return True def run_clang_apply_replacements(): @@ -623,6 +631,15 @@ def run_fixit_tests(requested_checks): success = False continue + + # Some fixed cpp files have an header that was also fixed. Compare it here too. + possible_headerfile_expected = test.expectedFixedFilename().replace('.cpp', '.h') + if os.path.exists(possible_headerfile_expected): + possible_headerfile = test.fixedFilename().replace('.cpp', '.h') + if not compare_files(False, possible_headerfile_expected, possible_headerfile, test.printableName(True, True).replace('.cpp', '.h')): + success = False + continue + return success def dump_ast(check): |