Mercurial > hg
annotate tests/test-diff-ignore-whitespace @ 2947:2d865068f72e
Add self to contributors
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Fri, 18 Aug 2006 15:03:16 -0700 |
parents | 7a87aebd848e |
children | 096f1c73cdc3 |
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() { |
2610
7a87aebd848e
Fix sed expression for OS X and Solaris 2.6.
Lee Cantey <lcantey@gmail.com>
parents:
2594
diff
changeset
|
6 hg diff "$@" | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
7a87aebd848e
Fix sed expression for OS X and Solaris 2.6.
Lee Cantey <lcantey@gmail.com>
parents:
2594
diff
changeset
|
7 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" |
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 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
76 hg init |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
77 printf 'hello world\ngoodbye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
78 hg ci -Amfoo -ufoo -d '0 0' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
79 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
80 test_added_blank_lines |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
81 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
|
82 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
|
83 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
|
84 test_increased_horizontal_whitespace_amount |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
85 test_added_blank_line_with_horizontal_whitespace |