diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2021-03-10 08:41:54 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2021-03-16 21:01:54 -0400 |
commit | 0638e38bfc8ef969c7ea9e2005ff051c14dab0f9 (patch) | |
tree | 41bb16d587cd02728f2bddd6c31e9a425674d95b /run_unittests.py | |
parent | f55868927721f273640a3ba7a8e703d418a352b6 (diff) | |
download | meson-0638e38bfc8ef969c7ea9e2005ff051c14dab0f9.zip meson-0638e38bfc8ef969c7ea9e2005ff051c14dab0f9.tar.gz meson-0638e38bfc8ef969c7ea9e2005ff051c14dab0f9.tar.bz2 |
clangformat: Add clang-format-check target
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index b95ead2..03e931a 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -5602,10 +5602,23 @@ class AllPlatformTests(BasePlatformTests): shutil.copytree(testdir, newdir) self.new_builddir() self.init(newdir) + + # Should reformat 1 file but not return error output = self.build('clang-format') self.assertEqual(1, output.count('File reformatted:')) + + # Reset source tree then try again with clang-format-check, it should + # return an error code this time. + windows_proof_rmtree(newdir) + shutil.copytree(testdir, newdir) + with self.assertRaises(subprocess.CalledProcessError): + output = self.build('clang-format-check') + self.assertEqual(1, output.count('File reformatted:')) + + # All code has been reformatted already, so it should be no-op now. output = self.build('clang-format') self.assertEqual(0, output.count('File reformatted:')) + self.build('clang-format-check') class FailureTests(BasePlatformTests): |