tests/test-check-clang-format.t
author Augie Fackler <augie@google.com>
Wed, 17 Jan 2018 15:56:12 -0500
changeset 35669 39499bc31fcd
parent 34834 2e8477059d4f
child 37184 0024961aa493
permissions -rw-r--r--
formatting: enforce clang-format on all .cc files as well as .c files As part of my upcoming fuzzer patch we're going to grow some .cc files. They're not part of the release build (they're only used for fuzzing, which requires clang 6 which in turn implies a working C++ compiler), so I'm not terribly worried about growing some C++ files. Differential Revision: https://phab.mercurial-scm.org/D1874
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34834
2e8477059d4f test-clang-format: new test to verify that files stay clang-formatted
Augie Fackler <augie@google.com>
parents:
diff changeset
     1
#require clang-format test-repo
2e8477059d4f test-clang-format: new test to verify that files stay clang-formatted
Augie Fackler <augie@google.com>
parents:
diff changeset
     2
2e8477059d4f test-clang-format: new test to verify that files stay clang-formatted
Augie Fackler <augie@google.com>
parents:
diff changeset
     3
  $ . "$TESTDIR/helpers-testrepo.sh"
2e8477059d4f test-clang-format: new test to verify that files stay clang-formatted
Augie Fackler <augie@google.com>
parents:
diff changeset
     4
2e8477059d4f test-clang-format: new test to verify that files stay clang-formatted
Augie Fackler <augie@google.com>
parents:
diff changeset
     5
  $ cd "$TESTDIR"/..
35669
39499bc31fcd formatting: enforce clang-format on all .cc files as well as .c files
Augie Fackler <augie@google.com>
parents: 34834
diff changeset
     6
  $ for f in `testrepohg files 'set:(**.c or **.cc or **.h) and not "listfile:contrib/clang-format-blacklist"'` ; do
34834
2e8477059d4f test-clang-format: new test to verify that files stay clang-formatted
Augie Fackler <augie@google.com>
parents:
diff changeset
     7
  >   clang-format --style file $f > $f.formatted
2e8477059d4f test-clang-format: new test to verify that files stay clang-formatted
Augie Fackler <augie@google.com>
parents:
diff changeset
     8
  >   cmp $f $f.formatted || diff -u $f $f.formatted
2e8477059d4f test-clang-format: new test to verify that files stay clang-formatted
Augie Fackler <augie@google.com>
parents:
diff changeset
     9
  >   rm $f.formatted
2e8477059d4f test-clang-format: new test to verify that files stay clang-formatted
Augie Fackler <augie@google.com>
parents:
diff changeset
    10
  > done