aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-03-31 20:29:10 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2019-04-01 01:26:53 +0300
commite3e83e2acdec877c527b36542fc64867c5943f77 (patch)
tree990b4908dc8a6fa19a4164f1e7ef79f0ce08ab55 /run_unittests.py
parent2a030e33f3c000134fd0d19204133befcae338c2 (diff)
downloadmeson-e3e83e2acdec877c527b36542fc64867c5943f77.zip
meson-e3e83e2acdec877c527b36542fc64867c5943f77.tar.gz
meson-e3e83e2acdec877c527b36542fc64867c5943f77.tar.bz2
Also format headers with Clang-Format. Closes #5184.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/run_unittests.py b/run_unittests.py
index f22a9b2..f381efc 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -3271,20 +3271,25 @@ recommended as it is not supported on some platforms''')
testfile = os.path.join(testdir, 'prog.c')
badfile = os.path.join(testdir, 'prog_orig_c')
goodfile = os.path.join(testdir, 'prog_expected_c')
+ testheader = os.path.join(testdir, 'header.h')
+ badheader = os.path.join(testdir, 'header_orig_h')
+ goodheader = os.path.join(testdir, 'header_expected_h')
try:
- self.run_clangformat(testdir, testfile, badfile, goodfile)
+ shutil.copyfile(badfile, testfile)
+ shutil.copyfile(badheader, testheader)
+ self.init(testdir)
+ self.assertNotEqual(Path(testfile).read_text(),
+ Path(goodfile).read_text())
+ self.assertNotEqual(Path(testheader).read_text(),
+ Path(goodheader).read_text())
+ self.run_target('clang-format')
+ self.assertEqual(Path(testheader).read_text(),
+ Path(goodheader).read_text())
finally:
if os.path.exists(testfile):
os.unlink(testfile)
-
- def run_clangformat(self, testdir, testfile, badfile, goodfile):
- shutil.copyfile(badfile, testfile)
- self.init(testdir)
- self.assertNotEqual(Path(testfile).read_text(),
- Path(goodfile).read_text())
- self.run_target('clang-format')
- self.assertEqual(Path(testfile).read_text(),
- Path(goodfile).read_text())
+ if os.path.exists(testheader):
+ os.unlink(testheader)
def test_introspect_buildoptions_without_configured_build(self):
testdir = os.path.join(self.unit_test_dir, '56 introspect buildoptions')