whitespace: tests for git-apply --whitespace=fix with tab-in-indent
Signed-off-by: Chris Webb <chris@arachsys.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Chris Webb committed
Apr 3, 2010 at 00:37 UTC
a347b17f15dd5358ced8d447af144a46b224982d
1 file changed
+29
-24
t/t4124-apply-ws-rule.sh
+29
-24
@@ -11,21 +11,22 @@ prepare_test_file () {
11
# ! trailing-space
12
# @ space-before-tab
13
# # indent-with-non-tab
14
+ # % tab-in-indent
15
sed -e "s/_/ /g" -e "s/>/ /" <<-\EOF
16
An_SP in an ordinary line>and a HT.
16
- >A HT.
17
- _>A SP and a HT (@).
18
- _>_A SP, a HT and a SP (@).
17
+ >A HT (%).
18
+ _>A SP and a HT (@%).
19
+ _>_A SP, a HT and a SP (@%).
20
_______Seven SP.
21
________Eight SP (#).
21
- _______>Seven SP and a HT (@).
22
- ________>Eight SP and a HT (@#).
23
- _______>_Seven SP, a HT and a SP (@).
24
- ________>_Eight SP, a HT and a SP (@#).
22
+ _______>Seven SP and a HT (@%).
23
+ ________>Eight SP and a HT (@#%).
24
+ _______>_Seven SP, a HT and a SP (@%).
25
+ ________>_Eight SP, a HT and a SP (@#%).
26
_______________Fifteen SP (#).
26
- _______________>Fifteen SP and a HT (@#).
27
+ _______________>Fifteen SP and a HT (@#%).
28
________________Sixteen SP (#).
28
- ________________>Sixteen SP and a HT (@#).
29
+ ________________>Sixteen SP and a HT (@#%).
30
_____a__Five SP, a non WS, two SP.
31
A line with a (!) trailing SP_
32
A line with a (!) trailing HT>
@@ -39,7 +40,6 @@ apply_patch () {
40
}
41
42
test_fix () {
42
-
43
# fix should not barf
44
apply_patch --whitespace=fix || return 1
45
@@ -130,20 +130,25 @@ do
130
for i in - ''
131
do
132
case "$i" in '') ti='#' ;; *) ti= ;; esac
133
- rule=${t}trailing,${s}space,${i}indent
134
-
135
- rm -f .gitattributes
136
- test_expect_success "rule=$rule" '
137
- git config core.whitespace "$rule" &&
138
- test_fix "$tt$ts$ti"
139
- '
140
-
141
- test_expect_success "rule=$rule (attributes)" '
142
- git config --unset core.whitespace &&
143
- echo "target whitespace=$rule" >.gitattributes &&
144
- test_fix "$tt$ts$ti"
145
- '
146
-
133
+ for h in - ''
134
+ do
135
+ [ -z "$h$i" ] && continue
136
+ case "$h" in '') th='%' ;; *) th= ;; esac
137
+ rule=${t}trailing,${s}space,${i}indent,${h}tab
138
+
139
+ rm -f .gitattributes
140
+ test_expect_success "rule=$rule" '
141
+ git config core.whitespace "$rule" &&
142
+ test_fix "$tt$ts$ti$th"
143
+ '
144
+
145
+ test_expect_success "rule=$rule (attributes)" '
146
+ git config --unset core.whitespace &&
147
+ echo "target whitespace=$rule" >.gitattributes &&
148
+ test_fix "$tt$ts$ti$th"
149
+ '
150
+
151
+ done
152
done
153
done
154
done