Mercurial > hg
annotate tests/test-diff-ignore-whitespace @ 11627:04f76a954842
protocol: move the streamclone implementation into wireproto
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Tue, 20 Jul 2010 20:52:23 +0200 |
parents | 6c82beaaa11a |
children |
rev | line source |
---|---|
2594
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
2 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
3 # GNU diff is the reference for all of these results. |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
4 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
5 hgdiff() { |
4878
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
6 echo hg diff $@ |
3199
096f1c73cdc3
Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents:
2610
diff
changeset
|
7 hg diff --nodates "$@" |
2594
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
8 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
9 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
10 test_added_blank_lines() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
11 printf '\nhello world\n\ngoodbye world\n\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
12 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
13 echo '>>> two diffs showing three added lines <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
14 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
15 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
16 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
17 echo '>>> no diffs <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
18 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
19 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
20 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
21 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
22 test_added_horizontal_space_first_on_a_line() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
23 printf '\t hello world\ngoodbye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
24 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
25 echo '>>> four diffs showing added space first on the first line <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
26 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
27 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
28 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
29 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
30 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
31 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
32 test_added_horizontal_space_last_on_a_line() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
33 printf 'hello world\t \ngoodbye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
34 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
35 echo '>>> two diffs showing space appended to the first line <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
36 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
37 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
38 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
39 echo '>>> no diffs <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
40 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
41 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
42 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
43 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
44 test_added_horizontal_space_in_the_middle_of_a_word() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
45 printf 'hello world\ngood bye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
46 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
47 echo '>>> four diffs showing space inserted into "goodbye" <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
48 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
49 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
50 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
51 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
52 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
53 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
54 test_increased_horizontal_whitespace_amount() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
55 printf 'hello world\ngoodbye\t\t \tworld\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
56 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
57 echo '>>> two diffs showing changed whitespace amount in the last line <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
58 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
59 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
60 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
61 echo '>>> no diffs <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
62 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
63 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
64 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
65 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
66 test_added_blank_line_with_horizontal_whitespace() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
67 printf 'hello world\n \t\ngoodbye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
68 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
69 echo '>>> four diffs showing added blank line w/horizontal space <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
70 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
71 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
72 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
73 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
74 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
75 |
4878
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
76 test_added_blank_line_with_other_whitespace() { |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
77 printf 'hello world\n \t\ngoodbye world \n' >foo |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
78 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
79 echo '>>> three diffs showing added blank line w/other space <<<' |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
80 hgdiff |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
81 hgdiff -B |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
82 hgdiff -b |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
83 hgdiff -Bb |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
84 } |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
85 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
86 test_whitespace_changes() { |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
87 printf 'helloworld\ngoodbye\tworld \n' >foo |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
88 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
89 echo '>>> four diffs showing changed whitespace <<<' |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
90 hgdiff |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
91 hgdiff -B |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
92 hgdiff -b |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
93 hgdiff -Bb |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
94 hgdiff -w |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
95 } |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
96 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
97 test_whitespace_changes_and_blank_lines() { |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
98 printf 'helloworld\n\n\n\ngoodbye\tworld \n' >foo |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
99 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
100 echo '>>> five diffs showing changed whitespace <<<' |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
101 hgdiff |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
102 hgdiff -B |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
103 hgdiff -b |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
104 hgdiff -Bb |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
105 hgdiff -w |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
106 hgdiff -wB |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
107 } |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
108 |
2594
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
109 hg init |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
110 printf 'hello world\ngoodbye world\n' >foo |
8167
6c82beaaa11a
tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
4878
diff
changeset
|
111 hg ci -Amfoo -ufoo |
2594
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
112 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
113 test_added_blank_lines |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
114 test_added_horizontal_space_first_on_a_line |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
115 test_added_horizontal_space_last_on_a_line |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
116 test_added_horizontal_space_in_the_middle_of_a_word |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
117 test_increased_horizontal_whitespace_amount |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
118 test_added_blank_line_with_horizontal_whitespace |
4878
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
119 test_added_blank_line_with_other_whitespace |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
120 test_whitespace_changes |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
121 test_whitespace_changes_and_blank_lines |