@@ -11,21 +11,22 @@ prepare_test_file () {
11
11
# ! trailing-space
12
12
# @ space-before-tab
13
13
# # indent-with-non-tab
14
+ # % tab-in-indent
14
15
sed -e " s/_/ /g" -e " s/>/ /" << -\EOF
15
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 (@% ).
19
20
_______Seven SP.
20
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 (@#% ).
25
26
_______________Fifteen SP (#).
26
- _______________>Fifteen SP and a HT (@#).
27
+ _______________>Fifteen SP and a HT (@#% ).
27
28
________________Sixteen SP (#).
28
- ________________>Sixteen SP and a HT (@#).
29
+ ________________>Sixteen SP and a HT (@#% ).
29
30
_____a__Five SP, a non WS, two SP.
30
31
A line with a (!) trailing SP_
31
32
A line with a (!) trailing HT>
@@ -39,7 +40,6 @@ apply_patch () {
39
40
}
40
41
41
42
test_fix () {
42
-
43
43
# fix should not barf
44
44
apply_patch --whitespace=fix || return 1
45
45
130
130
for i in - ' '
131
131
do
132
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
147
152
done
148
153
done
149
154
done
0 commit comments