tests/test-diff-indent-heuristic.t
author Raphaël Gomès <rgomes@octobus.net>
Thu, 10 Aug 2023 11:01:07 +0200
changeset 50978 27e773aa607d
parent 49621 55c6ebd11cb9
permissions -rw-r--r--
rust: implement the `Graph` trait for all revlogs This is trivial and makes all the algorithms relying on the trait usable for more use cases.
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
49621
55c6ebd11cb9 tests: run many tests in $TESTTMP/repo instead of $TESTTMP
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 36678
diff changeset
    11
  $ hg init repo
55c6ebd11cb9 tests: run many tests in $TESTTMP/repo instead of $TESTTMP
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 36678
diff changeset
    12
  $ cd repo
36678
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    13
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    14
  $ cat > a.c <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    15
  > /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    16
  >  * This function returns 1.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    17
  >  */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    18
  > int f() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    19
  >   return 1;
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
  > /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    22
  >  * This function returns 2.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    23
  >  */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    24
  > int g() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    25
  >   return 2;
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
  > /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    28
  >  * This function returns 3.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    29
  >  */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    30
  > int h() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    31
  >   return 3;
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    32
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    33
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    34
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    35
  $ cat > b.c <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    36
  > if (x) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    37
  >    do_something();
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
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    40
  > if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    41
  >    do_something_else();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    42
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    43
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    44
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    45
  $ cat > c.rb <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    46
  > #!ruby
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    47
  > ["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    48
  >   i.upcase
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    49
  > end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    50
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    51
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    52
  $ cat > d.py <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    53
  > try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    54
  >     import foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    55
  > except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    56
  >     pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    57
  > try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    58
  >     import bar
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    59
  > except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    60
  >     pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    61
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    62
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    63
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
    64
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    65
  $ cat > spaces.txt <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    66
  > 1
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    67
  > 2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    68
  > a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    69
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    70
  > b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    71
  > 3
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    72
  > 4
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    73
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    74
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    75
  $ cat > functions.c <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    76
  > 1
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    77
  > 2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    78
  > /* function */
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
  >     foo
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
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    83
  > 3
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    84
  > 4
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    85
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    86
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    87
  $ hg commit -m 1 -A . -q
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    88
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    89
  $ cat > a.c <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    90
  > /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    91
  >  * This function returns 1.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    92
  >  */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    93
  > int f() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    94
  >   return 1;
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
  > /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    97
  >  * This function returns 3.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    98
  >  */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
    99
  > int h() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   100
  >   return 3;
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   101
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   102
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   103
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   104
  $ cat > b.c <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   105
  > if (x) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   106
  >    do_something();
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
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   109
  > if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   110
  >    do_another_thing();
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
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   113
  > if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   114
  >    do_something_else();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   115
  > }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   116
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   117
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   118
  $ cat > c.rb <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   119
  > #!ruby
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   120
  > ["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   121
  >   i
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   122
  > end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   123
  > ["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   124
  >   i.upcase
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   125
  > end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   126
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   127
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   128
  $ cat > d.py <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   129
  > try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   130
  >     import foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   131
  > except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   132
  >     pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   133
  > try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   134
  >     import baz
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   135
  > except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   136
  >     pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   137
  > try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   138
  >     import bar
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   139
  > except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   140
  >     pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   141
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   142
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   143
  $ cat > spaces.txt <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   144
  > 1
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   145
  > 2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   146
  > a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   147
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   148
  > b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   149
  > a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   150
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   151
  > b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   152
  > 3
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   153
  > 4
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   154
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   155
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   156
  $ cat > functions.c <<'EOF'
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   157
  > 1
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   158
  > 2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   159
  > /* function */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   160
  > bar() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   161
  >     foo
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
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   164
  > /* function */
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
  >     foo
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
  > 
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   169
  > 3
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   170
  > 4
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   171
  > EOF
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   172
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   173
#if xdiff
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   174
  $ hg diff --git
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   175
  diff --git a/a.c b/a.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   176
  --- a/a.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   177
  +++ b/a.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   178
  @@ -4,12 +4,6 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   179
   int f() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   180
     return 1;
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
  -/*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   183
  - * This function returns 2.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   184
  - */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   185
  -int g() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   186
  -  return 2;
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
   /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   189
    * This function returns 3.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   190
    */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   191
  diff --git a/b.c b/b.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   192
  --- a/b.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   193
  +++ b/b.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   194
  @@ -2,6 +2,10 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   195
      do_something();
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
   
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   198
  +if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   199
  +   do_another_thing();
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
  +
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   202
   if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   203
      do_something_else();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   204
   }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   205
  diff --git a/c.rb b/c.rb
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   206
  --- a/c.rb
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   207
  +++ b/c.rb
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   208
  @@ -1,4 +1,7 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   209
   #!ruby
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   210
  +["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   211
  +  i
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   212
  +end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   213
   ["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   214
     i.upcase
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   215
   end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   216
  diff --git a/d.py b/d.py
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   217
  --- a/d.py
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   218
  +++ b/d.py
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   219
  @@ -2,6 +2,10 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   220
       import foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   221
   except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   222
       pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   223
  +try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   224
  +    import baz
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   225
  +except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   226
  +    pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   227
   try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   228
       import bar
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   229
   except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   230
  diff --git a/functions.c b/functions.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   231
  --- a/functions.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   232
  +++ b/functions.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   233
  @@ -1,5 +1,10 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   234
   1
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   235
   2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   236
  +/* function */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   237
  +bar() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   238
  +    foo
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
  +
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   241
   /* function */
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
       foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   244
  diff --git a/spaces.txt b/spaces.txt
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   245
  --- a/spaces.txt
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   246
  +++ b/spaces.txt
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   247
  @@ -2,6 +2,9 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   248
   2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   249
   a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   250
   
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   251
  +b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   252
  +a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   253
  +
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   254
   b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   255
   3
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   256
   4
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   257
#else
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   258
  $ hg diff --git
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   259
  diff --git a/a.c b/a.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   260
  --- a/a.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   261
  +++ b/a.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   262
  @@ -5,12 +5,6 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   263
     return 1;
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
   /*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   266
  - * This function returns 2.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   267
  - */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   268
  -int g() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   269
  -  return 2;
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
  -/*
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   272
    * This function returns 3.
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   273
    */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   274
   int h() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   275
  diff --git a/b.c b/b.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   276
  --- a/b.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   277
  +++ b/b.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   278
  @@ -3,5 +3,9 @@
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
   
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   281
   if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   282
  +   do_another_thing();
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
  +
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   285
  +if (y) {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   286
      do_something_else();
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   287
   }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   288
  diff --git a/c.rb b/c.rb
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   289
  --- a/c.rb
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   290
  +++ b/c.rb
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   291
  @@ -1,4 +1,7 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   292
   #!ruby
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   293
   ["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   294
  +  i
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   295
  +end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   296
  +["foo", "bar", "baz"].map do |i|
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   297
     i.upcase
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   298
   end
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   299
  diff --git a/d.py b/d.py
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   300
  --- a/d.py
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   301
  +++ b/d.py
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   302
  @@ -3,6 +3,10 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   303
   except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   304
       pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   305
   try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   306
  +    import baz
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   307
  +except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   308
  +    pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   309
  +try:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   310
       import bar
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   311
   except ImportError:
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   312
       pass
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   313
  diff --git a/functions.c b/functions.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   314
  --- a/functions.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   315
  +++ b/functions.c
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   316
  @@ -1,6 +1,11 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   317
   1
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   318
   2
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   319
   /* function */
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   320
  +bar() {
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   321
  +    foo
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
  +
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   324
  +/* function */
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
       foo
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   327
   }
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   328
  diff --git a/spaces.txt b/spaces.txt
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   329
  --- a/spaces.txt
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   330
  +++ b/spaces.txt
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   331
  @@ -3,5 +3,8 @@
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   332
   a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   333
   
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   334
   b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   335
  +a
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   336
  +
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   337
  +b
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   338
   3
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   339
   4
7834927f0243 tests: add tests about diff quality
Jun Wu <quark@fb.com>
parents:
diff changeset
   340
#endif