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