t0030-stripspace: modernize test format

Some tests in t0030-stripspace.sh used the older four space indent format. Update these to use tabs. Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Cai committed May 18, 2023 at 20:03 UTC 27990663f082da1a454507e1ee7e440524fcd090
1 file changed +271 -289
t/t0030-stripspace.sh
+271 -289
@@ -17,396 +17,378 @@ printf_git_stripspace () {
17 printf "$1" | git stripspace
18 }
19
20 -test_expect_success \
21 - 'long lines without spaces should be unchanged' '
22 - echo "$ttt" >expect &&
23 - git stripspace <expect >actual &&
24 - test_cmp expect actual &&
25 -
26 - echo "$ttt$ttt" >expect &&
27 - git stripspace <expect >actual &&
28 - test_cmp expect actual &&
29 -
30 - echo "$ttt$ttt$ttt" >expect &&
31 - git stripspace <expect >actual &&
32 - test_cmp expect actual &&
33 -
34 - echo "$ttt$ttt$ttt$ttt" >expect &&
35 - git stripspace <expect >actual &&
36 - test_cmp expect actual
20 +test_expect_success 'long lines without spaces should be unchanged' '
21 + echo "$ttt" >expect &&
22 + git stripspace <expect >actual &&
23 + test_cmp expect actual &&
24 +
25 + echo "$ttt$ttt" >expect &&
26 + git stripspace <expect >actual &&
27 + test_cmp expect actual &&
28 +
29 + echo "$ttt$ttt$ttt" >expect &&
30 + git stripspace <expect >actual &&
31 + test_cmp expect actual &&
32 +
33 + echo "$ttt$ttt$ttt$ttt" >expect &&
34 + git stripspace <expect >actual &&
35 + test_cmp expect actual
36 '
37
39 -test_expect_success \
40 - 'lines with spaces at the beginning should be unchanged' '
41 - echo "$sss$ttt" >expect &&
42 - git stripspace <expect >actual &&
43 - test_cmp expect actual &&
38 +test_expect_success 'lines with spaces at the beginning should be unchanged' '
39 + echo "$sss$ttt" >expect &&
40 + git stripspace <expect >actual &&
41 + test_cmp expect actual &&
42
45 - echo "$sss$sss$ttt" >expect &&
46 - git stripspace <expect >actual &&
47 - test_cmp expect actual &&
43 + echo "$sss$sss$ttt" >expect &&
44 + git stripspace <expect >actual &&
45 + test_cmp expect actual &&
46
49 - echo "$sss$sss$sss$ttt" >expect &&
50 - git stripspace <expect >actual &&
51 - test_cmp expect actual
47 + echo "$sss$sss$sss$ttt" >expect &&
48 + git stripspace <expect >actual &&
49 + test_cmp expect actual
50 '
51
54 -test_expect_success \
55 - 'lines with intermediate spaces should be unchanged' '
56 - echo "$ttt$sss$ttt" >expect &&
57 - git stripspace <expect >actual &&
58 - test_cmp expect actual &&
52 +test_expect_success 'lines with intermediate spaces should be unchanged' '
53 + echo "$ttt$sss$ttt" >expect &&
54 + git stripspace <expect >actual &&
55 + test_cmp expect actual &&
56
60 - echo "$ttt$sss$sss$ttt" >expect &&
61 - git stripspace <expect >actual &&
62 - test_cmp expect actual
57 + echo "$ttt$sss$sss$ttt" >expect &&
58 + git stripspace <expect >actual &&
59 + test_cmp expect actual
60 '
61
65 -test_expect_success \
66 - 'consecutive blank lines should be unified' '
67 - printf "$ttt\n\n$ttt\n" > expect &&
68 - printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
69 - test_cmp expect actual &&
62 +test_expect_success 'consecutive blank lines should be unified' '
63 + printf "$ttt\n\n$ttt\n" > expect &&
64 + printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
65 + test_cmp expect actual &&
66
71 - printf "$ttt$ttt\n\n$ttt\n" > expect &&
72 - printf "$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
73 - test_cmp expect actual &&
67 + printf "$ttt$ttt\n\n$ttt\n" > expect &&
68 + printf "$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
69 + test_cmp expect actual &&
70
75 - printf "$ttt$ttt$ttt\n\n$ttt\n" > expect &&
76 - printf "$ttt$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
77 - test_cmp expect actual &&
71 + printf "$ttt$ttt$ttt\n\n$ttt\n" > expect &&
72 + printf "$ttt$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
73 + test_cmp expect actual &&
74
79 - printf "$ttt\n\n$ttt\n" > expect &&
80 - printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
81 - test_cmp expect actual &&
75 + printf "$ttt\n\n$ttt\n" > expect &&
76 + printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
77 + test_cmp expect actual &&
78
83 - printf "$ttt\n\n$ttt$ttt\n" > expect &&
84 - printf "$ttt\n\n\n\n\n$ttt$ttt\n" | git stripspace >actual &&
85 - test_cmp expect actual &&
79 + printf "$ttt\n\n$ttt$ttt\n" > expect &&
80 + printf "$ttt\n\n\n\n\n$ttt$ttt\n" | git stripspace >actual &&
81 + test_cmp expect actual &&
82
87 - printf "$ttt\n\n$ttt$ttt$ttt\n" > expect &&
88 - printf "$ttt\n\n\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual &&
89 - test_cmp expect actual &&
83 + printf "$ttt\n\n$ttt$ttt$ttt\n" > expect &&
84 + printf "$ttt\n\n\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual &&
85 + test_cmp expect actual &&
86
91 - printf "$ttt\n\n$ttt\n" > expect &&
92 - printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
93 - test_cmp expect actual &&
87 + printf "$ttt\n\n$ttt\n" > expect &&
88 + printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
89 + test_cmp expect actual &&
90
95 - printf "$ttt$ttt\n\n$ttt\n" > expect &&
96 - printf "$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
97 - test_cmp expect actual &&
91 + printf "$ttt$ttt\n\n$ttt\n" > expect &&
92 + printf "$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
93 + test_cmp expect actual &&
94
99 - printf "$ttt$ttt$ttt\n\n$ttt\n" > expect &&
100 - printf "$ttt$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
101 - test_cmp expect actual &&
95 + printf "$ttt$ttt$ttt\n\n$ttt\n" > expect &&
96 + printf "$ttt$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
97 + test_cmp expect actual &&
98
103 - printf "$ttt\n\n$ttt\n" > expect &&
104 - printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
105 - test_cmp expect actual &&
99 + printf "$ttt\n\n$ttt\n" > expect &&
100 + printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
101 + test_cmp expect actual &&
102
107 - printf "$ttt\n\n$ttt$ttt\n" > expect &&
108 - printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt\n" | git stripspace >actual &&
109 - test_cmp expect actual &&
103 + printf "$ttt\n\n$ttt$ttt\n" > expect &&
104 + printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt\n" | git stripspace >actual &&
105 + test_cmp expect actual &&
106
111 - printf "$ttt\n\n$ttt$ttt$ttt\n" > expect &&
112 - printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt$ttt\n" | git stripspace >actual &&
113 - test_cmp expect actual
107 + printf "$ttt\n\n$ttt$ttt$ttt\n" > expect &&
108 + printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt$ttt\n" | git stripspace >actual &&
109 + test_cmp expect actual
110 '
111
116 -test_expect_success \
117 - 'only consecutive blank lines should be completely removed' '
112 +test_expect_success 'only consecutive blank lines should be completely removed' '
113 + printf "\n" | git stripspace >actual &&
114 + test_must_be_empty actual &&
115
119 - printf "\n" | git stripspace >actual &&
120 - test_must_be_empty actual &&
116 + printf "\n\n\n" | git stripspace >actual &&
117 + test_must_be_empty actual &&
118
122 - printf "\n\n\n" | git stripspace >actual &&
123 - test_must_be_empty actual &&
119 + printf "$sss\n$sss\n$sss\n" | git stripspace >actual &&
120 + test_must_be_empty actual &&
121
125 - printf "$sss\n$sss\n$sss\n" | git stripspace >actual &&
126 - test_must_be_empty actual &&
122 + printf "$sss$sss\n$sss\n\n" | git stripspace >actual &&
123 + test_must_be_empty actual &&
124
128 - printf "$sss$sss\n$sss\n\n" | git stripspace >actual &&
129 - test_must_be_empty actual &&
125 + printf "\n$sss\n$sss$sss\n" | git stripspace >actual &&
126 + test_must_be_empty actual &&
127
131 - printf "\n$sss\n$sss$sss\n" | git stripspace >actual &&
132 - test_must_be_empty actual &&
128 + printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual &&
129 + test_must_be_empty actual &&
130
134 - printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual &&
135 - test_must_be_empty actual &&
131 + printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual &&
132 + test_must_be_empty actual &&
133
137 - printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual &&
138 - test_must_be_empty actual &&
139 -
140 - printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual &&
141 - test_must_be_empty actual
134 + printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual &&
135 + test_must_be_empty actual
136 '
137
144 -test_expect_success \
145 - 'consecutive blank lines at the beginning should be removed' '
146 - printf "$ttt\n" > expect &&
147 - printf "\n$ttt\n" | git stripspace >actual &&
148 - test_cmp expect actual &&
138 +test_expect_success 'consecutive blank lines at the beginning should be removed' '
139 + printf "$ttt\n" > expect &&
140 + printf "\n$ttt\n" | git stripspace >actual &&
141 + test_cmp expect actual &&
142
150 - printf "$ttt\n" > expect &&
151 - printf "\n\n\n$ttt\n" | git stripspace >actual &&
152 - test_cmp expect actual &&
143 + printf "$ttt\n" > expect &&
144 + printf "\n\n\n$ttt\n" | git stripspace >actual &&
145 + test_cmp expect actual &&
146
154 - printf "$ttt$ttt\n" > expect &&
155 - printf "\n\n\n$ttt$ttt\n" | git stripspace >actual &&
156 - test_cmp expect actual &&
147 + printf "$ttt$ttt\n" > expect &&
148 + printf "\n\n\n$ttt$ttt\n" | git stripspace >actual &&
149 + test_cmp expect actual &&
150
158 - printf "$ttt$ttt$ttt\n" > expect &&
159 - printf "\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual &&
160 - test_cmp expect actual &&
151 + printf "$ttt$ttt$ttt\n" > expect &&
152 + printf "\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual &&
153 + test_cmp expect actual &&
154
162 - printf "$ttt$ttt$ttt$ttt\n" > expect &&
163 - printf "\n\n\n$ttt$ttt$ttt$ttt\n" | git stripspace >actual &&
164 - test_cmp expect actual &&
155 + printf "$ttt$ttt$ttt$ttt\n" > expect &&
156 + printf "\n\n\n$ttt$ttt$ttt$ttt\n" | git stripspace >actual &&
157 + test_cmp expect actual &&
158
166 - printf "$ttt\n" > expect &&
159 + printf "$ttt\n" > expect &&
160
168 - printf "$sss\n$sss\n$sss\n$ttt\n" | git stripspace >actual &&
169 - test_cmp expect actual &&
161 + printf "$sss\n$sss\n$sss\n$ttt\n" | git stripspace >actual &&
162 + test_cmp expect actual &&
163
171 - printf "\n$sss\n$sss$sss\n$ttt\n" | git stripspace >actual &&
172 - test_cmp expect actual &&
164 + printf "\n$sss\n$sss$sss\n$ttt\n" | git stripspace >actual &&
165 + test_cmp expect actual &&
166
174 - printf "$sss$sss\n$sss\n\n$ttt\n" | git stripspace >actual &&
175 - test_cmp expect actual &&
167 + printf "$sss$sss\n$sss\n\n$ttt\n" | git stripspace >actual &&
168 + test_cmp expect actual &&
169
177 - printf "$sss$sss$sss\n\n\n$ttt\n" | git stripspace >actual &&
178 - test_cmp expect actual &&
170 + printf "$sss$sss$sss\n\n\n$ttt\n" | git stripspace >actual &&
171 + test_cmp expect actual &&
172
180 - printf "\n$sss$sss$sss\n\n$ttt\n" | git stripspace >actual &&
181 - test_cmp expect actual &&
173 + printf "\n$sss$sss$sss\n\n$ttt\n" | git stripspace >actual &&
174 + test_cmp expect actual &&
175
183 - printf "\n\n$sss$sss$sss\n$ttt\n" | git stripspace >actual &&
184 - test_cmp expect actual
176 + printf "\n\n$sss$sss$sss\n$ttt\n" | git stripspace >actual &&
177 + test_cmp expect actual
178 '
179
187 -test_expect_success \
188 - 'consecutive blank lines at the end should be removed' '
189 - printf "$ttt\n" > expect &&
190 - printf "$ttt\n\n" | git stripspace >actual &&
191 - test_cmp expect actual &&
180 +test_expect_success 'consecutive blank lines at the end should be removed' '
181 + printf "$ttt\n" > expect &&
182 + printf "$ttt\n\n" | git stripspace >actual &&
183 + test_cmp expect actual &&
184
193 - printf "$ttt\n" > expect &&
194 - printf "$ttt\n\n\n\n" | git stripspace >actual &&
195 - test_cmp expect actual &&
185 + printf "$ttt\n" > expect &&
186 + printf "$ttt\n\n\n\n" | git stripspace >actual &&
187 + test_cmp expect actual &&
188
197 - printf "$ttt$ttt\n" > expect &&
198 - printf "$ttt$ttt\n\n\n\n" | git stripspace >actual &&
199 - test_cmp expect actual &&
189 + printf "$ttt$ttt\n" > expect &&
190 + printf "$ttt$ttt\n\n\n\n" | git stripspace >actual &&
191 + test_cmp expect actual &&
192
201 - printf "$ttt$ttt$ttt\n" > expect &&
202 - printf "$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual &&
203 - test_cmp expect actual &&
193 + printf "$ttt$ttt$ttt\n" > expect &&
194 + printf "$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual &&
195 + test_cmp expect actual &&
196
205 - printf "$ttt$ttt$ttt$ttt\n" > expect &&
206 - printf "$ttt$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual &&
207 - test_cmp expect actual &&
197 + printf "$ttt$ttt$ttt$ttt\n" > expect &&
198 + printf "$ttt$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual &&
199 + test_cmp expect actual &&
200
209 - printf "$ttt\n" > expect &&
201 + printf "$ttt\n" > expect &&
202
211 - printf "$ttt\n$sss\n$sss\n$sss\n" | git stripspace >actual &&
212 - test_cmp expect actual &&
203 + printf "$ttt\n$sss\n$sss\n$sss\n" | git stripspace >actual &&
204 + test_cmp expect actual &&
205
214 - printf "$ttt\n\n$sss\n$sss$sss\n" | git stripspace >actual &&
215 - test_cmp expect actual &&
206 + printf "$ttt\n\n$sss\n$sss$sss\n" | git stripspace >actual &&
207 + test_cmp expect actual &&
208
217 - printf "$ttt\n$sss$sss\n$sss\n\n" | git stripspace >actual &&
218 - test_cmp expect actual &&
209 + printf "$ttt\n$sss$sss\n$sss\n\n" | git stripspace >actual &&
210 + test_cmp expect actual &&
211
220 - printf "$ttt\n$sss$sss$sss\n\n\n" | git stripspace >actual &&
221 - test_cmp expect actual &&
212 + printf "$ttt\n$sss$sss$sss\n\n\n" | git stripspace >actual &&
213 + test_cmp expect actual &&
214
223 - printf "$ttt\n\n$sss$sss$sss\n\n" | git stripspace >actual &&
224 - test_cmp expect actual &&
215 + printf "$ttt\n\n$sss$sss$sss\n\n" | git stripspace >actual &&
216 + test_cmp expect actual &&
217
226 - printf "$ttt\n\n\n$sss$sss$sss\n" | git stripspace >actual &&
227 - test_cmp expect actual
218 + printf "$ttt\n\n\n$sss$sss$sss\n" | git stripspace >actual &&
219 + test_cmp expect actual
220 '
221
230 -test_expect_success \
231 - 'text without newline at end should end with newline' '
232 - test_stdout_line_count -gt 0 printf_git_stripspace "$ttt" &&
233 - test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt" &&
234 - test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$ttt" &&
235 - test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$ttt$ttt"
222 +test_expect_success 'text without newline at end should end with newline' '
223 + test_stdout_line_count -gt 0 printf_git_stripspace "$ttt" &&
224 + test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt" &&
225 + test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$ttt" &&
226 + test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$ttt$ttt"
227 '
228
229 # text plus spaces at the end:
230
240 -test_expect_success \
241 - 'text plus spaces without newline at end should end with newline' '
242 - test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$sss" &&
243 - test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$sss" &&
244 - test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$ttt$sss" &&
245 - test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$sss$sss" &&
246 - test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$sss$sss" &&
247 - test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$sss$sss$sss"
231 +test_expect_success 'text plus spaces without newline at end should end with newline' '
232 + test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$sss" &&
233 + test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$sss" &&
234 + test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$ttt$sss" &&
235 + test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$sss$sss" &&
236 + test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$sss$sss" &&
237 + test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$sss$sss$sss"
238 '
239
250 -test_expect_success \
251 - 'text plus spaces without newline at end should not show spaces' '
252 - printf "$ttt$sss" | git stripspace >tmp &&
253 - ! grep " " tmp >/dev/null &&
254 - printf "$ttt$ttt$sss" | git stripspace >tmp &&
255 - ! grep " " tmp >/dev/null &&
256 - printf "$ttt$ttt$ttt$sss" | git stripspace >tmp &&
257 - ! grep " " tmp >/dev/null &&
258 - printf "$ttt$sss$sss" | git stripspace >tmp &&
259 - ! grep " " tmp >/dev/null &&
260 - printf "$ttt$ttt$sss$sss" | git stripspace >tmp &&
261 - ! grep " " tmp >/dev/null &&
262 - printf "$ttt$sss$sss$sss" | git stripspace >tmp &&
263 - ! grep " " tmp >/dev/null
240 +test_expect_success 'text plus spaces without newline at end should not show spaces' '
241 + printf "$ttt$sss" | git stripspace >tmp &&
242 + ! grep " " tmp >/dev/null &&
243 + printf "$ttt$ttt$sss" | git stripspace >tmp &&
244 + ! grep " " tmp >/dev/null &&
245 + printf "$ttt$ttt$ttt$sss" | git stripspace >tmp &&
246 + ! grep " " tmp >/dev/null &&
247 + printf "$ttt$sss$sss" | git stripspace >tmp &&
248 + ! grep " " tmp >/dev/null &&
249 + printf "$ttt$ttt$sss$sss" | git stripspace >tmp &&
250 + ! grep " " tmp >/dev/null &&
251 + printf "$ttt$sss$sss$sss" | git stripspace >tmp &&
252 + ! grep " " tmp >/dev/null
253 '
254
266 -test_expect_success \
267 - 'text plus spaces without newline should show the correct lines' '
268 - printf "$ttt\n" >expect &&
269 - printf "$ttt$sss" | git stripspace >actual &&
270 - test_cmp expect actual &&
255 +test_expect_success 'text plus spaces without newline should show the correct lines' '
256 + printf "$ttt\n" >expect &&
257 + printf "$ttt$sss" | git stripspace >actual &&
258 + test_cmp expect actual &&
259
272 - printf "$ttt\n" >expect &&
273 - printf "$ttt$sss$sss" | git stripspace >actual &&
274 - test_cmp expect actual &&
260 + printf "$ttt\n" >expect &&
261 + printf "$ttt$sss$sss" | git stripspace >actual &&
262 + test_cmp expect actual &&
263
276 - printf "$ttt\n" >expect &&
277 - printf "$ttt$sss$sss$sss" | git stripspace >actual &&
278 - test_cmp expect actual &&
264 + printf "$ttt\n" >expect &&
265 + printf "$ttt$sss$sss$sss" | git stripspace >actual &&
266 + test_cmp expect actual &&
267
280 - printf "$ttt$ttt\n" >expect &&
281 - printf "$ttt$ttt$sss" | git stripspace >actual &&
282 - test_cmp expect actual &&
268 + printf "$ttt$ttt\n" >expect &&
269 + printf "$ttt$ttt$sss" | git stripspace >actual &&
270 + test_cmp expect actual &&
271
284 - printf "$ttt$ttt\n" >expect &&
285 - printf "$ttt$ttt$sss$sss" | git stripspace >actual &&
286 - test_cmp expect actual &&
272 + printf "$ttt$ttt\n" >expect &&
273 + printf "$ttt$ttt$sss$sss" | git stripspace >actual &&
274 + test_cmp expect actual &&
275
288 - printf "$ttt$ttt$ttt\n" >expect &&
289 - printf "$ttt$ttt$ttt$sss" | git stripspace >actual &&
290 - test_cmp expect actual
276 + printf "$ttt$ttt$ttt\n" >expect &&
277 + printf "$ttt$ttt$ttt$sss" | git stripspace >actual &&
278 + test_cmp expect actual
279 '
280
293 -test_expect_success \
294 - 'text plus spaces at end should not show spaces' '
295 - echo "$ttt$sss" | git stripspace >tmp &&
296 - ! grep " " tmp >/dev/null &&
297 - echo "$ttt$ttt$sss" | git stripspace >tmp &&
298 - ! grep " " tmp >/dev/null &&
299 - echo "$ttt$ttt$ttt$sss" | git stripspace >tmp &&
300 - ! grep " " tmp >/dev/null &&
301 - echo "$ttt$sss$sss" | git stripspace >tmp &&
302 - ! grep " " tmp >/dev/null &&
303 - echo "$ttt$ttt$sss$sss" | git stripspace >tmp &&
304 - ! grep " " tmp >/dev/null &&
305 - echo "$ttt$sss$sss$sss" | git stripspace >tmp &&
306 - ! grep " " tmp >/dev/null
281 +test_expect_success 'text plus spaces at end should not show spaces' '
282 + echo "$ttt$sss" | git stripspace >tmp &&
283 + ! grep " " tmp >/dev/null &&
284 + echo "$ttt$ttt$sss" | git stripspace >tmp &&
285 + ! grep " " tmp >/dev/null &&
286 + echo "$ttt$ttt$ttt$sss" | git stripspace >tmp &&
287 + ! grep " " tmp >/dev/null &&
288 + echo "$ttt$sss$sss" | git stripspace >tmp &&
289 + ! grep " " tmp >/dev/null &&
290 + echo "$ttt$ttt$sss$sss" | git stripspace >tmp &&
291 + ! grep " " tmp >/dev/null &&
292 + echo "$ttt$sss$sss$sss" | git stripspace >tmp &&
293 + ! grep " " tmp >/dev/null
294 '
295
309 -test_expect_success \
310 - 'text plus spaces at end should be cleaned and newline must remain' '
311 - echo "$ttt" >expect &&
312 - echo "$ttt$sss" | git stripspace >actual &&
313 - test_cmp expect actual &&
296 +test_expect_success 'text plus spaces at end should be cleaned and newline must remain' '
297 + echo "$ttt" >expect &&
298 + echo "$ttt$sss" | git stripspace >actual &&
299 + test_cmp expect actual &&
300
315 - echo "$ttt" >expect &&
316 - echo "$ttt$sss$sss" | git stripspace >actual &&
317 - test_cmp expect actual &&
301 + echo "$ttt" >expect &&
302 + echo "$ttt$sss$sss" | git stripspace >actual &&
303 + test_cmp expect actual &&
304
319 - echo "$ttt" >expect &&
320 - echo "$ttt$sss$sss$sss" | git stripspace >actual &&
321 - test_cmp expect actual &&
305 + echo "$ttt" >expect &&
306 + echo "$ttt$sss$sss$sss" | git stripspace >actual &&
307 + test_cmp expect actual &&
308
323 - echo "$ttt$ttt" >expect &&
324 - echo "$ttt$ttt$sss" | git stripspace >actual &&
325 - test_cmp expect actual &&
309 + echo "$ttt$ttt" >expect &&
310 + echo "$ttt$ttt$sss" | git stripspace >actual &&
311 + test_cmp expect actual &&
312
327 - echo "$ttt$ttt" >expect &&
328 - echo "$ttt$ttt$sss$sss" | git stripspace >actual &&
329 - test_cmp expect actual &&
313 + echo "$ttt$ttt" >expect &&
314 + echo "$ttt$ttt$sss$sss" | git stripspace >actual &&
315 + test_cmp expect actual &&
316
331 - echo "$ttt$ttt$ttt" >expect &&
332 - echo "$ttt$ttt$ttt$sss" | git stripspace >actual &&
333 - test_cmp expect actual
317 + echo "$ttt$ttt$ttt" >expect &&
318 + echo "$ttt$ttt$ttt$sss" | git stripspace >actual &&
319 + test_cmp expect actual
320 '
321
322 # spaces only:
323
338 -test_expect_success \
339 - 'spaces with newline at end should be replaced with empty string' '
340 - echo | git stripspace >actual &&
341 - test_must_be_empty actual &&
324 +test_expect_success 'spaces with newline at end should be replaced with empty string' '
325 + echo | git stripspace >actual &&
326 + test_must_be_empty actual &&
327
343 - echo "$sss" | git stripspace >actual &&
344 - test_must_be_empty actual &&
328 + echo "$sss" | git stripspace >actual &&
329 + test_must_be_empty actual &&
330
346 - echo "$sss$sss" | git stripspace >actual &&
347 - test_must_be_empty actual &&
331 + echo "$sss$sss" | git stripspace >actual &&
332 + test_must_be_empty actual &&
333
349 - echo "$sss$sss$sss" | git stripspace >actual &&
350 - test_must_be_empty actual &&
334 + echo "$sss$sss$sss" | git stripspace >actual &&
335 + test_must_be_empty actual &&
336
352 - echo "$sss$sss$sss$sss" | git stripspace >actual &&
353 - test_must_be_empty actual
337 + echo "$sss$sss$sss$sss" | git stripspace >actual &&
338 + test_must_be_empty actual
339 '
340
356 -test_expect_success \
357 - 'spaces without newline at end should not show spaces' '
358 - printf "" | git stripspace >tmp &&
359 - ! grep " " tmp >/dev/null &&
360 - printf "$sss" | git stripspace >tmp &&
361 - ! grep " " tmp >/dev/null &&
362 - printf "$sss$sss" | git stripspace >tmp &&
363 - ! grep " " tmp >/dev/null &&
364 - printf "$sss$sss$sss" | git stripspace >tmp &&
365 - ! grep " " tmp >/dev/null &&
366 - printf "$sss$sss$sss$sss" | git stripspace >tmp &&
367 - ! grep " " tmp >/dev/null
341 +test_expect_success 'spaces without newline at end should not show spaces' '
342 + printf "" | git stripspace >tmp &&
343 + ! grep " " tmp >/dev/null &&
344 + printf "$sss" | git stripspace >tmp &&
345 + ! grep " " tmp >/dev/null &&
346 + printf "$sss$sss" | git stripspace >tmp &&
347 + ! grep " " tmp >/dev/null &&
348 + printf "$sss$sss$sss" | git stripspace >tmp &&
349 + ! grep " " tmp >/dev/null &&
350 + printf "$sss$sss$sss$sss" | git stripspace >tmp &&
351 + ! grep " " tmp >/dev/null
352 '
353
370 -test_expect_success \
371 - 'spaces without newline at end should be replaced with empty string' '
372 - printf "" | git stripspace >actual &&
373 - test_must_be_empty actual &&
354 +test_expect_success 'spaces without newline at end should be replaced with empty string' '
355 + printf "" | git stripspace >actual &&
356 + test_must_be_empty actual &&
357
375 - printf "$sss$sss" | git stripspace >actual &&
376 - test_must_be_empty actual &&
358 + printf "$sss$sss" | git stripspace >actual &&
359 + test_must_be_empty actual &&
360
378 - printf "$sss$sss$sss" | git stripspace >actual &&
379 - test_must_be_empty actual &&
361 + printf "$sss$sss$sss" | git stripspace >actual &&
362 + test_must_be_empty actual &&
363
381 - printf "$sss$sss$sss$sss" | git stripspace >actual &&
382 - test_must_be_empty actual
364 + printf "$sss$sss$sss$sss" | git stripspace >actual &&
365 + test_must_be_empty actual
366 '
367
385 -test_expect_success \
386 - 'consecutive text lines should be unchanged' '
387 - printf "$ttt$ttt\n$ttt\n" >expect &&
388 - printf "$ttt$ttt\n$ttt\n" | git stripspace >actual &&
389 - test_cmp expect actual &&
368 +test_expect_success 'consecutive text lines should be unchanged' '
369 + printf "$ttt$ttt\n$ttt\n" >expect &&
370 + printf "$ttt$ttt\n$ttt\n" | git stripspace >actual &&
371 + test_cmp expect actual &&
372
391 - printf "$ttt\n$ttt$ttt\n$ttt\n" >expect &&
392 - printf "$ttt\n$ttt$ttt\n$ttt\n" | git stripspace >actual &&
393 - test_cmp expect actual &&
373 + printf "$ttt\n$ttt$ttt\n$ttt\n" >expect &&
374 + printf "$ttt\n$ttt$ttt\n$ttt\n" | git stripspace >actual &&
375 + test_cmp expect actual &&
376
395 - printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" >expect &&
396 - printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" | git stripspace >actual &&
397 - test_cmp expect actual &&
377 + printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" >expect &&
378 + printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" | git stripspace >actual &&
379 + test_cmp expect actual &&
380
399 - printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" >expect &&
400 - printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" | git stripspace >actual &&
401 - test_cmp expect actual &&
381 + printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" >expect &&
382 + printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" | git stripspace >actual &&
383 + test_cmp expect actual &&
384
403 - printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" >expect &&
404 - printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" | git stripspace >actual &&
405 - test_cmp expect actual &&
385 + printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" >expect &&
386 + printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" | git stripspace >actual &&
387 + test_cmp expect actual &&
388
407 - printf "$ttt\n$ttt$ttt\n\n$ttt\n" >expect &&
408 - printf "$ttt\n$ttt$ttt\n\n$ttt\n" | git stripspace >actual &&
409 - test_cmp expect actual
389 + printf "$ttt\n$ttt$ttt\n\n$ttt\n" >expect &&
390 + printf "$ttt\n$ttt$ttt\n\n$ttt\n" | git stripspace >actual &&
391 + test_cmp expect actual
392 '
393
394 test_expect_success 'strip comments, too' '