tests/test-diff-indent-heuristic.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Tue, 21 Sep 2021 18:03:37 +0200
branchstable
changeset 48039 c094e829e848
parent 36678 7834927f0243
child 49621 55c6ebd11cb9
permissions -rw-r--r--
changelog: also monitor `00changelog.n` when applicable (issue6554) This let the locarepo's file cache detect outdated nodemap docket and reload the changelog after `localrepo.invalidate` when applicable. Differential Revision: https://phab.mercurial-scm.org/D11482
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36678
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     1
#testcases bdiff xdiff
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     3
#if xdiff
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     4
#require xdiff
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     5
  $ cat >> $HGRCPATH <<EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     6
  > [experimental]
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     7
  > xdiff = true
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     8
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
     9
#endif
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    10
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    11
  $ hg init
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    12
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    13
  $ cat > a.c <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    14
  > /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    15
  >  * This function returns 1.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    16
  >  */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    17
  > int f() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    18
  >   return 1;
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    19
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    20
  > /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    21
  >  * This function returns 2.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    22
  >  */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    23
  > int g() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    24
  >   return 2;
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    25
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    26
  > /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    27
  >  * This function returns 3.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    28
  >  */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    29
  > int h() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    30
  >   return 3;
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    31
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    32
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    33
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    34
  $ cat > b.c <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    35
  > if (x) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    36
  >    do_something();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    37
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    38
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    39
  > if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    40
  >    do_something_else();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    41
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    42
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    43
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    44
  $ cat > c.rb <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    45
  > #!ruby
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    46
  > ["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    47
  >   i.upcase
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    48
  > end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    49
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    50
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    51
  $ cat > d.py <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    52
  > try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    53
  >     import foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    54
  > except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    55
  >     pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    56
  > try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    57
  >     import bar
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    58
  > except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    59
  >     pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    60
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    61
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    62
The below two files are taken from git: t/t4061-diff-indent.sh
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    63
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    64
  $ cat > spaces.txt <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    65
  > 1
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    66
  > 2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    67
  > a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    68
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    69
  > b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    70
  > 3
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    71
  > 4
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    72
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    73
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    74
  $ cat > functions.c <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    75
  > 1
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    76
  > 2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    77
  > /* function */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    78
  > foo() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    79
  >     foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    80
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    81
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    82
  > 3
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    83
  > 4
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    84
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    85
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    86
  $ hg commit -m 1 -A . -q
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    87
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    88
  $ cat > a.c <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    89
  > /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    90
  >  * This function returns 1.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    91
  >  */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    92
  > int f() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    93
  >   return 1;
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    94
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    95
  > /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    96
  >  * This function returns 3.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    97
  >  */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    98
  > int h() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    99
  >   return 3;
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   100
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   101
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   102
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   103
  $ cat > b.c <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   104
  > if (x) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   105
  >    do_something();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   106
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   107
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   108
  > if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   109
  >    do_another_thing();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   110
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   111
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   112
  > if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   113
  >    do_something_else();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   114
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   115
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   116
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   117
  $ cat > c.rb <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   118
  > #!ruby
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   119
  > ["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   120
  >   i
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   121
  > end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   122
  > ["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   123
  >   i.upcase
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   124
  > end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   125
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   126
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   127
  $ cat > d.py <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   128
  > try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   129
  >     import foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   130
  > except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   131
  >     pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   132
  > try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   133
  >     import baz
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   134
  > except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   135
  >     pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   136
  > try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   137
  >     import bar
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   138
  > except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   139
  >     pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   140
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   141
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   142
  $ cat > spaces.txt <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   143
  > 1
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   144
  > 2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   145
  > a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   146
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   147
  > b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   148
  > a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   149
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   150
  > b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   151
  > 3
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   152
  > 4
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   153
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   154
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   155
  $ cat > functions.c <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   156
  > 1
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   157
  > 2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   158
  > /* function */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   159
  > bar() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   160
  >     foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   161
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   162
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   163
  > /* function */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   164
  > foo() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   165
  >     foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   166
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   167
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   168
  > 3
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   169
  > 4
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   170
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   171
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   172
#if xdiff
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   173
  $ hg diff --git
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   174
  diff --git a/a.c b/a.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   175
  --- a/a.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   176
  +++ b/a.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   177
  @@ -4,12 +4,6 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   178
   int f() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   179
     return 1;
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   180
   }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   181
  -/*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   182
  - * This function returns 2.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   183
  - */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   184
  -int g() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   185
  -  return 2;
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   186
  -}
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   187
   /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   188
    * This function returns 3.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   189
    */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   190
  diff --git a/b.c b/b.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   191
  --- a/b.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   192
  +++ b/b.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   193
  @@ -2,6 +2,10 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   194
      do_something();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   195
   }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   196
   
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   197
  +if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   198
  +   do_another_thing();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   199
  +}
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   200
  +
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   201
   if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   202
      do_something_else();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   203
   }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   204
  diff --git a/c.rb b/c.rb
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   205
  --- a/c.rb
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   206
  +++ b/c.rb
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   207
  @@ -1,4 +1,7 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   208
   #!ruby
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   209
  +["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   210
  +  i
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   211
  +end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   212
   ["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   213
     i.upcase
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   214
   end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   215
  diff --git a/d.py b/d.py
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   216
  --- a/d.py
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   217
  +++ b/d.py
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   218
  @@ -2,6 +2,10 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   219
       import foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   220
   except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   221
       pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   222
  +try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   223
  +    import baz
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   224
  +except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   225
  +    pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   226
   try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   227
       import bar
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   228
   except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   229
  diff --git a/functions.c b/functions.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   230
  --- a/functions.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   231
  +++ b/functions.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   232
  @@ -1,5 +1,10 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   233
   1
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   234
   2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   235
  +/* function */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   236
  +bar() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   237
  +    foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   238
  +}
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   239
  +
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   240
   /* function */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   241
   foo() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   242
       foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   243
  diff --git a/spaces.txt b/spaces.txt
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   244
  --- a/spaces.txt
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   245
  +++ b/spaces.txt
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   246
  @@ -2,6 +2,9 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   247
   2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   248
   a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   249
   
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   250
  +b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   251
  +a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   252
  +
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   253
   b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   254
   3
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   255
   4
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   256
#else
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   257
  $ hg diff --git
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   258
  diff --git a/a.c b/a.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   259
  --- a/a.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   260
  +++ b/a.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   261
  @@ -5,12 +5,6 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   262
     return 1;
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   263
   }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   264
   /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   265
  - * This function returns 2.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   266
  - */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   267
  -int g() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   268
  -  return 2;
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   269
  -}
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   270
  -/*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   271
    * This function returns 3.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   272
    */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   273
   int h() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   274
  diff --git a/b.c b/b.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   275
  --- a/b.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   276
  +++ b/b.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   277
  @@ -3,5 +3,9 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   278
   }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   279
   
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   280
   if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   281
  +   do_another_thing();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   282
  +}
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   283
  +
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   284
  +if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   285
      do_something_else();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   286
   }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   287
  diff --git a/c.rb b/c.rb
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   288
  --- a/c.rb
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   289
  +++ b/c.rb
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   290
  @@ -1,4 +1,7 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   291
   #!ruby
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   292
   ["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   293
  +  i
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   294
  +end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   295
  +["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   296
     i.upcase
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   297
   end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   298
  diff --git a/d.py b/d.py
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   299
  --- a/d.py
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   300
  +++ b/d.py
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   301
  @@ -3,6 +3,10 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   302
   except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   303
       pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   304
   try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   305
  +    import baz
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   306
  +except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   307
  +    pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   308
  +try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   309
       import bar
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   310
   except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   311
       pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   312
  diff --git a/functions.c b/functions.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   313
  --- a/functions.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   314
  +++ b/functions.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   315
  @@ -1,6 +1,11 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   316
   1
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   317
   2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   318
   /* function */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   319
  +bar() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   320
  +    foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   321
  +}
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   322
  +
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   323
  +/* function */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   324
   foo() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   325
       foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   326
   }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   327
  diff --git a/spaces.txt b/spaces.txt
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   328
  --- a/spaces.txt
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   329
  +++ b/spaces.txt
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   330
  @@ -3,5 +3,8 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   331
   a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   332
   
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   333
   b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   334
  +a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   335
  +
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   336
  +b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   337
   3
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   338
   4
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   339
#endif