tests/test-fix-clang-format.t
author Augie Fackler <augie@google.com>
Sat, 28 Apr 2018 00:42:16 -0400
branchstable
changeset 38187 90a274965de7
parent 37183 ded5ea279a93
child 40533 2ecf5c24d0cd
permissions -rw-r--r--
mpatch: be more careful about parsing binary patch data (SEC) It appears to have been possible to trivially walk off the end of an allocated region with a malformed patch. Oops. Caught when writing an mpatch fuzzer for oss-fuzz. This defect is OVE-20180430-0001. A CVE has not been obtained as of this writing.

#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:fileset=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 ..