Show More
@@ -1,121 +1,392 | |||||
1 | #!/bin/sh |
|
1 | GNU diff is the reference for all of these results. | |
|
2 | ||||
|
3 | Prepare tests: | |||
|
4 | ||||
|
5 | $ echo '[alias]' >> $HGRCPATH | |||
|
6 | $ echo 'ndiff = diff --nodates' >> $HGRCPATH | |||
2 |
|
7 | |||
3 | # GNU diff is the reference for all of these results. |
|
8 | $ hg init | |
|
9 | $ printf 'hello world\ngoodbye world\n' >foo | |||
|
10 | $ hg ci -Amfoo -ufoo | |||
|
11 | adding foo | |||
|
12 | ||||
|
13 | ||||
|
14 | Test added blank lines: | |||
|
15 | ||||
|
16 | $ printf '\nhello world\n\ngoodbye world\n\n' >foo | |||
|
17 | ||||
|
18 | >>> two diffs showing three added lines <<< | |||
4 |
|
19 | |||
5 | hgdiff() { |
|
20 | $ hg ndiff | |
6 | echo hg diff $@ |
|
21 | diff -r 540c40a65b78 foo | |
7 | hg diff --nodates "$@" |
|
22 | --- a/foo | |
8 | } |
|
23 | +++ b/foo | |
|
24 | @@ -1,2 +1,5 @@ | |||
|
25 | + | |||
|
26 | hello world | |||
|
27 | + | |||
|
28 | goodbye world | |||
|
29 | + | |||
|
30 | $ hg ndiff -b | |||
|
31 | diff -r 540c40a65b78 foo | |||
|
32 | --- a/foo | |||
|
33 | +++ b/foo | |||
|
34 | @@ -1,2 +1,5 @@ | |||
|
35 | + | |||
|
36 | hello world | |||
|
37 | + | |||
|
38 | goodbye world | |||
|
39 | + | |||
9 |
|
40 | |||
10 | test_added_blank_lines() { |
|
41 | >>> no diffs <<< | |
11 | printf '\nhello world\n\ngoodbye world\n\n' >foo |
|
42 | ||
|
43 | $ hg ndiff -B | |||
|
44 | $ hg ndiff -Bb | |||
|
45 | ||||
12 |
|
46 | |||
13 | echo '>>> two diffs showing three added lines <<<' |
|
47 | Test added horizontal space first on a line(): | |
14 | hgdiff |
|
48 | ||
15 | hgdiff -b |
|
49 | $ printf '\t hello world\ngoodbye world\n' >foo | |
|
50 | ||||
|
51 | >>> four diffs showing added space first on the first line <<< | |||
|
52 | ||||
|
53 | $ hg ndiff | |||
|
54 | diff -r 540c40a65b78 foo | |||
|
55 | --- a/foo | |||
|
56 | +++ b/foo | |||
|
57 | @@ -1,2 +1,2 @@ | |||
|
58 | -hello world | |||
|
59 | + hello world | |||
|
60 | goodbye world | |||
|
61 | ||||
|
62 | $ hg ndiff -b | |||
|
63 | diff -r 540c40a65b78 foo | |||
|
64 | --- a/foo | |||
|
65 | +++ b/foo | |||
|
66 | @@ -1,2 +1,2 @@ | |||
|
67 | -hello world | |||
|
68 | + hello world | |||
|
69 | goodbye world | |||
16 |
|
70 | |||
17 | echo '>>> no diffs <<<' |
|
71 | $ hg ndiff -B | |
18 | hgdiff -B |
|
72 | diff -r 540c40a65b78 foo | |
19 | hgdiff -Bb |
|
73 | --- a/foo | |
20 | } |
|
74 | +++ b/foo | |
|
75 | @@ -1,2 +1,2 @@ | |||
|
76 | -hello world | |||
|
77 | + hello world | |||
|
78 | goodbye world | |||
21 |
|
79 | |||
22 | test_added_horizontal_space_first_on_a_line() { |
|
80 | $ hg ndiff -Bb | |
23 | printf '\t hello world\ngoodbye world\n' >foo |
|
81 | diff -r 540c40a65b78 foo | |
|
82 | --- a/foo | |||
|
83 | +++ b/foo | |||
|
84 | @@ -1,2 +1,2 @@ | |||
|
85 | -hello world | |||
|
86 | + hello world | |||
|
87 | goodbye world | |||
|
88 | ||||
|
89 | ||||
|
90 | Test added horizontal space last on a line: | |||
|
91 | ||||
|
92 | $ printf 'hello world\t \ngoodbye world\n' >foo | |||
|
93 | ||||
|
94 | >>> two diffs showing space appended to the first line <<< | |||
24 |
|
95 | |||
25 | echo '>>> four diffs showing added space first on the first line <<<' |
|
96 | $ hg ndiff | |
26 | hgdiff |
|
97 | diff -r 540c40a65b78 foo | |
27 | hgdiff -b |
|
98 | --- a/foo | |
28 | hgdiff -B |
|
99 | +++ b/foo | |
29 | hgdiff -Bb |
|
100 | @@ -1,2 +1,2 @@ | |
30 | } |
|
101 | -hello world | |
|
102 | +hello world | |||
|
103 | goodbye world | |||
|
104 | ||||
|
105 | $ hg ndiff -B | |||
|
106 | diff -r 540c40a65b78 foo | |||
|
107 | --- a/foo | |||
|
108 | +++ b/foo | |||
|
109 | @@ -1,2 +1,2 @@ | |||
|
110 | -hello world | |||
|
111 | +hello world | |||
|
112 | goodbye world | |||
|
113 | ||||
|
114 | >>> no diffs <<< | |||
|
115 | ||||
|
116 | $ hg ndiff -b | |||
|
117 | $ hg ndiff -Bb | |||
|
118 | ||||
31 |
|
119 | |||
32 | test_added_horizontal_space_last_on_a_line() { |
|
120 | Test added horizontal space in the middle of a word: | |
33 | printf 'hello world\t \ngoodbye world\n' >foo |
|
121 | ||
|
122 | $ printf 'hello world\ngood bye world\n' >foo | |||
|
123 | ||||
|
124 | >>> four diffs showing space inserted into "goodbye" <<< | |||
34 |
|
125 | |||
35 | echo '>>> two diffs showing space appended to the first line <<<' |
|
126 | $ hg ndiff | |
36 | hgdiff |
|
127 | diff -r 540c40a65b78 foo | |
37 | hgdiff -B |
|
128 | --- a/foo | |
|
129 | +++ b/foo | |||
|
130 | @@ -1,2 +1,2 @@ | |||
|
131 | hello world | |||
|
132 | -goodbye world | |||
|
133 | +good bye world | |||
|
134 | ||||
|
135 | $ hg ndiff -B | |||
|
136 | diff -r 540c40a65b78 foo | |||
|
137 | --- a/foo | |||
|
138 | +++ b/foo | |||
|
139 | @@ -1,2 +1,2 @@ | |||
|
140 | hello world | |||
|
141 | -goodbye world | |||
|
142 | +good bye world | |||
38 |
|
143 | |||
39 | echo '>>> no diffs <<<' |
|
144 | $ hg ndiff -b | |
40 | hgdiff -b |
|
145 | diff -r 540c40a65b78 foo | |
41 | hgdiff -Bb |
|
146 | --- a/foo | |
42 | } |
|
147 | +++ b/foo | |
|
148 | @@ -1,2 +1,2 @@ | |||
|
149 | hello world | |||
|
150 | -goodbye world | |||
|
151 | +good bye world | |||
43 |
|
152 | |||
44 | test_added_horizontal_space_in_the_middle_of_a_word() { |
|
153 | $ hg ndiff -Bb | |
45 | printf 'hello world\ngood bye world\n' >foo |
|
154 | diff -r 540c40a65b78 foo | |
|
155 | --- a/foo | |||
|
156 | +++ b/foo | |||
|
157 | @@ -1,2 +1,2 @@ | |||
|
158 | hello world | |||
|
159 | -goodbye world | |||
|
160 | +good bye world | |||
|
161 | ||||
|
162 | ||||
|
163 | Test increased horizontal whitespace amount: | |||
|
164 | ||||
|
165 | $ printf 'hello world\ngoodbye\t\t \tworld\n' >foo | |||
|
166 | ||||
|
167 | >>> two diffs showing changed whitespace amount in the last line <<< | |||
46 |
|
168 | |||
47 | echo '>>> four diffs showing space inserted into "goodbye" <<<' |
|
169 | $ hg ndiff | |
48 | hgdiff |
|
170 | diff -r 540c40a65b78 foo | |
49 | hgdiff -B |
|
171 | --- a/foo | |
50 | hgdiff -b |
|
172 | +++ b/foo | |
51 | hgdiff -Bb |
|
173 | @@ -1,2 +1,2 @@ | |
52 | } |
|
174 | hello world | |
|
175 | -goodbye world | |||
|
176 | +goodbye world | |||
53 |
|
177 | |||
54 | test_increased_horizontal_whitespace_amount() { |
|
178 | $ hg ndiff -B | |
55 | printf 'hello world\ngoodbye\t\t \tworld\n' >foo |
|
179 | diff -r 540c40a65b78 foo | |
|
180 | --- a/foo | |||
|
181 | +++ b/foo | |||
|
182 | @@ -1,2 +1,2 @@ | |||
|
183 | hello world | |||
|
184 | -goodbye world | |||
|
185 | +goodbye world | |||
56 |
|
186 | |||
57 | echo '>>> two diffs showing changed whitespace amount in the last line <<<' |
|
187 | >>> no diffs <<< | |
58 | hgdiff |
|
188 | ||
59 |
|
|
189 | $ hg ndiff -b | |
|
190 | $ hg ndiff -Bb | |||
|
191 | ||||
|
192 | ||||
|
193 | Test added blank line with horizontal whitespace: | |||
|
194 | ||||
|
195 | $ printf 'hello world\n \t\ngoodbye world\n' >foo | |||
60 |
|
196 | |||
61 | echo '>>> no diffs <<<' |
|
197 | >>> three diffs showing added blank line with horizontal space <<< | |
62 | hgdiff -b |
|
198 | ||
63 |
|
|
199 | $ hg ndiff | |
64 | } |
|
200 | diff -r 540c40a65b78 foo | |
|
201 | --- a/foo | |||
|
202 | +++ b/foo | |||
|
203 | @@ -1,2 +1,3 @@ | |||
|
204 | hello world | |||
|
205 | + | |||
|
206 | goodbye world | |||
|
207 | ||||
|
208 | $ hg ndiff -B | |||
|
209 | diff -r 540c40a65b78 foo | |||
|
210 | --- a/foo | |||
|
211 | +++ b/foo | |||
|
212 | @@ -1,2 +1,3 @@ | |||
|
213 | hello world | |||
|
214 | + | |||
|
215 | goodbye world | |||
65 |
|
216 | |||
66 | test_added_blank_line_with_horizontal_whitespace() { |
|
217 | $ hg ndiff -b | |
67 | printf 'hello world\n \t\ngoodbye world\n' >foo |
|
218 | diff -r 540c40a65b78 foo | |
|
219 | --- a/foo | |||
|
220 | +++ b/foo | |||
|
221 | @@ -1,2 +1,3 @@ | |||
|
222 | hello world | |||
|
223 | + | |||
|
224 | goodbye world | |||
|
225 | ||||
|
226 | >>> no diffs <<< | |||
|
227 | ||||
|
228 | $ hg ndiff -Bb | |||
|
229 | ||||
|
230 | ||||
|
231 | Test added blank line with other whitespace: | |||
|
232 | ||||
|
233 | $ printf 'hello world\n \t\ngoodbye world \n' >foo | |||
|
234 | ||||
|
235 | >>> three diffs showing added blank line with other space <<< | |||
68 |
|
236 | |||
69 | echo '>>> four diffs showing added blank line w/horizontal space <<<' |
|
237 | $ hg ndiff | |
70 | hgdiff |
|
238 | diff -r 540c40a65b78 foo | |
71 | hgdiff -B |
|
239 | --- a/foo | |
72 | hgdiff -b |
|
240 | +++ b/foo | |
73 | hgdiff -Bb |
|
241 | @@ -1,2 +1,3 @@ | |
74 | } |
|
242 | -hello world | |
|
243 | -goodbye world | |||
|
244 | +hello world | |||
|
245 | + | |||
|
246 | +goodbye world | |||
75 |
|
247 | |||
76 | test_added_blank_line_with_other_whitespace() { |
|
248 | $ hg ndiff -B | |
77 | printf 'hello world\n \t\ngoodbye world \n' >foo |
|
249 | diff -r 540c40a65b78 foo | |
|
250 | --- a/foo | |||
|
251 | +++ b/foo | |||
|
252 | @@ -1,2 +1,3 @@ | |||
|
253 | -hello world | |||
|
254 | -goodbye world | |||
|
255 | +hello world | |||
|
256 | + | |||
|
257 | +goodbye world | |||
78 |
|
258 | |||
79 | echo '>>> three diffs showing added blank line w/other space <<<' |
|
259 | $ hg ndiff -b | |
80 | hgdiff |
|
260 | diff -r 540c40a65b78 foo | |
81 | hgdiff -B |
|
261 | --- a/foo | |
82 | hgdiff -b |
|
262 | +++ b/foo | |
83 | hgdiff -Bb |
|
263 | @@ -1,2 +1,3 @@ | |
84 | } |
|
264 | hello world | |
|
265 | + | |||
|
266 | goodbye world | |||
|
267 | ||||
|
268 | >>> no diffs <<< | |||
|
269 | ||||
|
270 | $ hg ndiff -Bb | |||
|
271 | ||||
85 |
|
272 | |||
86 |
|
|
273 | Test whitespace changes: | |
87 | printf 'helloworld\ngoodbye\tworld \n' >foo |
|
274 | ||
|
275 | $ printf 'helloworld\ngoodbye\tworld \n' >foo | |||
|
276 | ||||
|
277 | >>> four diffs showing changed whitespace <<< | |||
|
278 | ||||
|
279 | $ hg ndiff | |||
|
280 | diff -r 540c40a65b78 foo | |||
|
281 | --- a/foo | |||
|
282 | +++ b/foo | |||
|
283 | @@ -1,2 +1,2 @@ | |||
|
284 | -hello world | |||
|
285 | -goodbye world | |||
|
286 | +helloworld | |||
|
287 | +goodbye world | |||
88 |
|
288 | |||
89 | echo '>>> four diffs showing changed whitespace <<<' |
|
289 | $ hg ndiff -B | |
90 | hgdiff |
|
290 | diff -r 540c40a65b78 foo | |
91 | hgdiff -B |
|
291 | --- a/foo | |
92 | hgdiff -b |
|
292 | +++ b/foo | |
93 | hgdiff -Bb |
|
293 | @@ -1,2 +1,2 @@ | |
94 | hgdiff -w |
|
294 | -hello world | |
95 | } |
|
295 | -goodbye world | |
|
296 | +helloworld | |||
|
297 | +goodbye world | |||
|
298 | ||||
|
299 | $ hg ndiff -b | |||
|
300 | diff -r 540c40a65b78 foo | |||
|
301 | --- a/foo | |||
|
302 | +++ b/foo | |||
|
303 | @@ -1,2 +1,2 @@ | |||
|
304 | -hello world | |||
|
305 | +helloworld | |||
|
306 | goodbye world | |||
96 |
|
307 | |||
97 | test_whitespace_changes_and_blank_lines() { |
|
308 | $ hg ndiff -Bb | |
98 | printf 'helloworld\n\n\n\ngoodbye\tworld \n' >foo |
|
309 | diff -r 540c40a65b78 foo | |
|
310 | --- a/foo | |||
|
311 | +++ b/foo | |||
|
312 | @@ -1,2 +1,2 @@ | |||
|
313 | -hello world | |||
|
314 | +helloworld | |||
|
315 | goodbye world | |||
|
316 | ||||
|
317 | >>> no diffs <<< | |||
|
318 | ||||
|
319 | $ hg ndiff -w | |||
|
320 | ||||
|
321 | ||||
|
322 | Test whitespace changes and blank lines: | |||
|
323 | ||||
|
324 | $ printf 'helloworld\n\n\n\ngoodbye\tworld \n' >foo | |||
|
325 | ||||
|
326 | >>> five diffs showing changed whitespace <<< | |||
|
327 | ||||
|
328 | $ hg ndiff | |||
|
329 | diff -r 540c40a65b78 foo | |||
|
330 | --- a/foo | |||
|
331 | +++ b/foo | |||
|
332 | @@ -1,2 +1,5 @@ | |||
|
333 | -hello world | |||
|
334 | -goodbye world | |||
|
335 | +helloworld | |||
|
336 | + | |||
|
337 | + | |||
|
338 | + | |||
|
339 | +goodbye world | |||
99 |
|
340 | |||
100 | echo '>>> five diffs showing changed whitespace <<<' |
|
341 | $ hg ndiff -B | |
101 | hgdiff |
|
342 | diff -r 540c40a65b78 foo | |
102 | hgdiff -B |
|
343 | --- a/foo | |
103 | hgdiff -b |
|
344 | +++ b/foo | |
104 | hgdiff -Bb |
|
345 | @@ -1,2 +1,5 @@ | |
105 | hgdiff -w |
|
346 | -hello world | |
106 | hgdiff -wB |
|
347 | -goodbye world | |
107 | } |
|
348 | +helloworld | |
|
349 | + | |||
|
350 | + | |||
|
351 | + | |||
|
352 | +goodbye world | |||
|
353 | ||||
|
354 | $ hg ndiff -b | |||
|
355 | diff -r 540c40a65b78 foo | |||
|
356 | --- a/foo | |||
|
357 | +++ b/foo | |||
|
358 | @@ -1,2 +1,5 @@ | |||
|
359 | -hello world | |||
|
360 | +helloworld | |||
|
361 | + | |||
|
362 | + | |||
|
363 | + | |||
|
364 | goodbye world | |||
108 |
|
365 | |||
109 | hg init |
|
366 | $ hg ndiff -Bb | |
110 | printf 'hello world\ngoodbye world\n' >foo |
|
367 | diff -r 540c40a65b78 foo | |
111 | hg ci -Amfoo -ufoo |
|
368 | --- a/foo | |
|
369 | +++ b/foo | |||
|
370 | @@ -1,2 +1,5 @@ | |||
|
371 | -hello world | |||
|
372 | +helloworld | |||
|
373 | + | |||
|
374 | + | |||
|
375 | + | |||
|
376 | goodbye world | |||
112 |
|
377 | |||
113 | test_added_blank_lines |
|
378 | $ hg ndiff -w | |
114 | test_added_horizontal_space_first_on_a_line |
|
379 | diff -r 540c40a65b78 foo | |
115 | test_added_horizontal_space_last_on_a_line |
|
380 | --- a/foo | |
116 | test_added_horizontal_space_in_the_middle_of_a_word |
|
381 | +++ b/foo | |
117 | test_increased_horizontal_whitespace_amount |
|
382 | @@ -1,2 +1,5 @@ | |
118 | test_added_blank_line_with_horizontal_whitespace |
|
383 | hello world | |
119 | test_added_blank_line_with_other_whitespace |
|
384 | + | |
120 | test_whitespace_changes |
|
385 | + | |
121 | test_whitespace_changes_and_blank_lines |
|
386 | + | |
|
387 | goodbye world | |||
|
388 | ||||
|
389 | >>> no diffs <<< | |||
|
390 | ||||
|
391 | $ hg ndiff -wB | |||
|
392 |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now