tests/test-fix-clang-format.t
author Matt Harbison <matt_harbison@yahoo.com>
Sat, 01 May 2021 16:13:53 -0400
branchstable
changeset 47066 9e3979a25bfe
parent 40533 2ecf5c24d0cd
permissions -rw-r--r--
tests: stabilize test-persistent-nodemap.t on Windows Several issues here: - Hooks can't invoke shell scripts on Windows, so use `sh` to launch - `dd` in MSYS only recognizes `status=noxfer` - The `PATH` updating triggered a massive slowdown, but is no longer needed I have no idea why, but removing the `PATH` update substantially increased the speed of the test. It was running finishing at ~4:30 with `--debug` and ~14:50 without it, but now completes in ~2:20 on my Windows laptop. Differential Revision: https://phab.mercurial-scm.org/D10636

#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 ..