| 1 |
#require clang-format |
| 2 |
|
| 3 |
Test that a simple "hg fix" configuration for clang-format works. |
| 4 |
|
| 5 |
$ cat >> $HGRCPATH <<EOF |
| 6 |
> [extensions] |
| 7 |
> fix = |
| 8 |
> [experimental] |
| 9 |
> evolution.createmarkers=True |
| 10 |
> evolution.allowunstable=True |
| 11 |
> [fix] |
| 12 |
> clang-format:command=clang-format --style=Google --assume-filename={rootpath} |
| 13 |
> clang-format:linerange=--lines={first}:{last} |
| 14 |
> clang-format:pattern=set:**.cpp or **.hpp |
| 15 |
> EOF |
| 16 |
|
| 17 |
$ hg init repo |
| 18 |
$ cd repo |
| 19 |
|
| 20 |
$ printf "void foo(){int x=2;}\n" > foo.cpp |
| 21 |
$ printf "void\nfoo();\n" > foo.hpp |
| 22 |
$ hg commit -Am "foo commit" |
| 23 |
adding foo.cpp |
| 24 |
adding foo.hpp |
| 25 |
$ hg cat -r tip * |
| 26 |
void foo(){int x=2;} |
| 27 |
void |
| 28 |
foo(); |
| 29 |
$ hg fix -r tip |
| 30 |
$ hg cat -r tip * |
| 31 |
void foo() { int x = 2; } |
| 32 |
void foo(); |
| 33 |
|
| 34 |
$ cd .. |