Show More
@@ -1,84 +1,85 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | # GNU diff is the reference for all of these results. |
|
3 | # GNU diff is the reference for all of these results. | |
4 |
|
4 | |||
5 | hgdiff() { |
|
5 | hgdiff() { | |
6 |
hg diff "$@" | sed "s/\( |
|
6 | hg diff "$@" | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ | |
|
7 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" | |||
7 | } |
|
8 | } | |
8 |
|
9 | |||
9 | test_added_blank_lines() { |
|
10 | test_added_blank_lines() { | |
10 | printf '\nhello world\n\ngoodbye world\n\n' >foo |
|
11 | printf '\nhello world\n\ngoodbye world\n\n' >foo | |
11 |
|
12 | |||
12 | echo '>>> two diffs showing three added lines <<<' |
|
13 | echo '>>> two diffs showing three added lines <<<' | |
13 | hgdiff |
|
14 | hgdiff | |
14 | hgdiff -b |
|
15 | hgdiff -b | |
15 |
|
16 | |||
16 | echo '>>> no diffs <<<' |
|
17 | echo '>>> no diffs <<<' | |
17 | hgdiff -B |
|
18 | hgdiff -B | |
18 | hgdiff -Bb |
|
19 | hgdiff -Bb | |
19 | } |
|
20 | } | |
20 |
|
21 | |||
21 | test_added_horizontal_space_first_on_a_line() { |
|
22 | test_added_horizontal_space_first_on_a_line() { | |
22 | printf '\t hello world\ngoodbye world\n' >foo |
|
23 | printf '\t hello world\ngoodbye world\n' >foo | |
23 |
|
24 | |||
24 | echo '>>> four diffs showing added space first on the first line <<<' |
|
25 | echo '>>> four diffs showing added space first on the first line <<<' | |
25 | hgdiff |
|
26 | hgdiff | |
26 | hgdiff -b |
|
27 | hgdiff -b | |
27 | hgdiff -B |
|
28 | hgdiff -B | |
28 | hgdiff -Bb |
|
29 | hgdiff -Bb | |
29 | } |
|
30 | } | |
30 |
|
31 | |||
31 | test_added_horizontal_space_last_on_a_line() { |
|
32 | test_added_horizontal_space_last_on_a_line() { | |
32 | printf 'hello world\t \ngoodbye world\n' >foo |
|
33 | printf 'hello world\t \ngoodbye world\n' >foo | |
33 |
|
34 | |||
34 | echo '>>> two diffs showing space appended to the first line <<<' |
|
35 | echo '>>> two diffs showing space appended to the first line <<<' | |
35 | hgdiff |
|
36 | hgdiff | |
36 | hgdiff -B |
|
37 | hgdiff -B | |
37 |
|
38 | |||
38 | echo '>>> no diffs <<<' |
|
39 | echo '>>> no diffs <<<' | |
39 | hgdiff -b |
|
40 | hgdiff -b | |
40 | hgdiff -Bb |
|
41 | hgdiff -Bb | |
41 | } |
|
42 | } | |
42 |
|
43 | |||
43 | test_added_horizontal_space_in_the_middle_of_a_word() { |
|
44 | test_added_horizontal_space_in_the_middle_of_a_word() { | |
44 | printf 'hello world\ngood bye world\n' >foo |
|
45 | printf 'hello world\ngood bye world\n' >foo | |
45 |
|
46 | |||
46 | echo '>>> four diffs showing space inserted into "goodbye" <<<' |
|
47 | echo '>>> four diffs showing space inserted into "goodbye" <<<' | |
47 | hgdiff |
|
48 | hgdiff | |
48 | hgdiff -B |
|
49 | hgdiff -B | |
49 | hgdiff -b |
|
50 | hgdiff -b | |
50 | hgdiff -Bb |
|
51 | hgdiff -Bb | |
51 | } |
|
52 | } | |
52 |
|
53 | |||
53 | test_increased_horizontal_whitespace_amount() { |
|
54 | test_increased_horizontal_whitespace_amount() { | |
54 | printf 'hello world\ngoodbye\t\t \tworld\n' >foo |
|
55 | printf 'hello world\ngoodbye\t\t \tworld\n' >foo | |
55 |
|
56 | |||
56 | echo '>>> two diffs showing changed whitespace amount in the last line <<<' |
|
57 | echo '>>> two diffs showing changed whitespace amount in the last line <<<' | |
57 | hgdiff |
|
58 | hgdiff | |
58 | hgdiff -B |
|
59 | hgdiff -B | |
59 |
|
60 | |||
60 | echo '>>> no diffs <<<' |
|
61 | echo '>>> no diffs <<<' | |
61 | hgdiff -b |
|
62 | hgdiff -b | |
62 | hgdiff -Bb |
|
63 | hgdiff -Bb | |
63 | } |
|
64 | } | |
64 |
|
65 | |||
65 | test_added_blank_line_with_horizontal_whitespace() { |
|
66 | test_added_blank_line_with_horizontal_whitespace() { | |
66 | printf 'hello world\n \t\ngoodbye world\n' >foo |
|
67 | printf 'hello world\n \t\ngoodbye world\n' >foo | |
67 |
|
68 | |||
68 | echo '>>> four diffs showing added blank line w/horizontal space <<<' |
|
69 | echo '>>> four diffs showing added blank line w/horizontal space <<<' | |
69 | hgdiff |
|
70 | hgdiff | |
70 | hgdiff -B |
|
71 | hgdiff -B | |
71 | hgdiff -b |
|
72 | hgdiff -b | |
72 | hgdiff -Bb |
|
73 | hgdiff -Bb | |
73 | } |
|
74 | } | |
74 |
|
75 | |||
75 | hg init |
|
76 | hg init | |
76 | printf 'hello world\ngoodbye world\n' >foo |
|
77 | printf 'hello world\ngoodbye world\n' >foo | |
77 | hg ci -Amfoo -ufoo -d '0 0' |
|
78 | hg ci -Amfoo -ufoo -d '0 0' | |
78 |
|
79 | |||
79 | test_added_blank_lines |
|
80 | test_added_blank_lines | |
80 | test_added_horizontal_space_first_on_a_line |
|
81 | test_added_horizontal_space_first_on_a_line | |
81 | test_added_horizontal_space_last_on_a_line |
|
82 | test_added_horizontal_space_last_on_a_line | |
82 | test_added_horizontal_space_in_the_middle_of_a_word |
|
83 | test_added_horizontal_space_in_the_middle_of_a_word | |
83 | test_increased_horizontal_whitespace_amount |
|
84 | test_increased_horizontal_whitespace_amount | |
84 | test_added_blank_line_with_horizontal_whitespace |
|
85 | test_added_blank_line_with_horizontal_whitespace |
General Comments 0
You need to be logged in to leave comments.
Login now