Mercurial > hg
annotate tests/test-diff-ignore-whitespace @ 4331:ce52deed83bc
atomicfile: don't copy the original file if it'll be truncated
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Mon, 09 Apr 2007 04:24:17 -0300 |
parents | 096f1c73cdc3 |
children | 372d93f03d3a |
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() { |
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
|
6 hg diff --nodates "$@" |
2594
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
7 } |
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 test_added_blank_lines() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
10 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
|
11 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
12 echo '>>> two diffs showing three added lines <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
13 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
14 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
15 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
16 echo '>>> no diffs <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
17 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
18 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
19 } |
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 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
|
22 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
|
23 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
24 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
|
25 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
26 hgdiff -b |
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 -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
29 } |
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 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
|
32 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
|
33 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
34 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
|
35 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
36 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
37 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
38 echo '>>> no diffs <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
39 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
40 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
41 } |
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 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
|
44 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
|
45 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
46 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
|
47 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
48 hgdiff -B |
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 -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
51 } |
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 test_increased_horizontal_whitespace_amount() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
54 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
|
55 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
56 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
|
57 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
58 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
59 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
60 echo '>>> no diffs <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
61 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
62 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
63 } |
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 test_added_blank_line_with_horizontal_whitespace() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
66 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
|
67 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
68 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
|
69 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
70 hgdiff -B |
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 -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
73 } |
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 hg init |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
76 printf 'hello world\ngoodbye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
77 hg ci -Amfoo -ufoo -d '0 0' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
78 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
79 test_added_blank_lines |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
80 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
|
81 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
|
82 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
|
83 test_increased_horizontal_whitespace_amount |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
84 test_added_blank_line_with_horizontal_whitespace |