tests/test-fix-clang-format.t
author Joerg Sonnenberger <joerg@bec.de>
Fri, 30 Apr 2021 02:11:58 +0200
changeset 47043 12450fbea288
parent 40533 2ecf5c24d0cd
permissions -rw-r--r--
manifests: push down expected node length into the parser This strictly enforces the node length in the manifest lines according to what the repository expects. One test case moves large hash testing into the non-treemanifest part as treemanifests don't provide an interface for overriding just the node length for now. Differential Revision: https://phab.mercurial-scm.org/D10533

#require clang-format

Test that a simple "hg fix" configuration for clang-format works.

  $ cat >> $HGRCPATH <<EOF
  > [extensions]
  > fix =
  > [experimental]
  > evolution.createmarkers=True
  > evolution.allowunstable=True
  > [fix]
  > clang-format:command=clang-format --style=Google --assume-filename={rootpath}
  > clang-format:linerange=--lines={first}:{last}
  > clang-format:pattern=set:**.cpp or **.hpp
  > EOF

  $ hg init repo
  $ cd repo

  $ printf "void foo(){int x=2;}\n" > foo.cpp
  $ printf "void\nfoo();\n" > foo.hpp
  $ hg commit -Am "foo commit"
  adding foo.cpp
  adding foo.hpp
  $ hg cat -r tip *
  void foo(){int x=2;}
  void
  foo();
  $ hg fix -r tip
  $ hg cat -r tip *
  void foo() { int x = 2; }
  void foo();

  $ cd ..