t7810: add missing variables to tests in loop
Some tests in t7810-grep.sh are in a loop that runs them against HEAD and the work tree. In order for that to work the test code should use the variables $L (display name), $H (HEAD or empty string) and $HC (revision prefix for result lines); otherwise tests are just repeated with the same target. Add the variables where they're missing and make sure the test description is wrapped in double quotes (instead of single quotes) to allow variables to be expanded. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Mar 11, 2014 at 22:07 UTC
9afad7a1e6363ed249a5cfcc95a35900ae4970cb
1 file changed
+29
-29
t/t7810-grep.sh
+29
-29
@@ -105,7 +105,7 @@ do
105
106
test_expect_success "grep -w $L (w)" '
107
: >expected &&
108
- test_must_fail git grep -n -w -e "^w" >actual &&
108
+ test_must_fail git grep -n -w -e "^w" $H >actual &&
109
test_cmp expected actual
110
'
111
@@ -240,92 +240,92 @@ do
240
test_cmp expected actual
241
'
242
test_expect_success "grep $L with grep.extendedRegexp=false" '
243
- echo "ab:a+bc" >expected &&
244
- git -c grep.extendedRegexp=false grep "a+b*c" ab >actual &&
243
+ echo "${HC}ab:a+bc" >expected &&
244
+ git -c grep.extendedRegexp=false grep "a+b*c" $H ab >actual &&
245
test_cmp expected actual
246
'
247
248
test_expect_success "grep $L with grep.extendedRegexp=true" '
249
- echo "ab:abc" >expected &&
250
- git -c grep.extendedRegexp=true grep "a+b*c" ab >actual &&
249
+ echo "${HC}ab:abc" >expected &&
250
+ git -c grep.extendedRegexp=true grep "a+b*c" $H ab >actual &&
251
test_cmp expected actual
252
'
253
254
test_expect_success "grep $L with grep.patterntype=basic" '
255
- echo "ab:a+bc" >expected &&
256
- git -c grep.patterntype=basic grep "a+b*c" ab >actual &&
255
+ echo "${HC}ab:a+bc" >expected &&
256
+ git -c grep.patterntype=basic grep "a+b*c" $H ab >actual &&
257
test_cmp expected actual
258
'
259
260
test_expect_success "grep $L with grep.patterntype=extended" '
261
- echo "ab:abc" >expected &&
262
- git -c grep.patterntype=extended grep "a+b*c" ab >actual &&
261
+ echo "${HC}ab:abc" >expected &&
262
+ git -c grep.patterntype=extended grep "a+b*c" $H ab >actual &&
263
test_cmp expected actual
264
'
265
266
test_expect_success "grep $L with grep.patterntype=fixed" '
267
- echo "ab:a+b*c" >expected &&
268
- git -c grep.patterntype=fixed grep "a+b*c" ab >actual &&
267
+ echo "${HC}ab:a+b*c" >expected &&
268
+ git -c grep.patterntype=fixed grep "a+b*c" $H ab >actual &&
269
test_cmp expected actual
270
'
271
272
test_expect_success LIBPCRE "grep $L with grep.patterntype=perl" '
273
- echo "ab:a+b*c" >expected &&
274
- git -c grep.patterntype=perl grep "a\x{2b}b\x{2a}c" ab >actual &&
273
+ echo "${HC}ab:a+b*c" >expected &&
274
+ git -c grep.patterntype=perl grep "a\x{2b}b\x{2a}c" $H ab >actual &&
275
test_cmp expected actual
276
'
277
278
test_expect_success "grep $L with grep.patternType=default and grep.extendedRegexp=true" '
279
- echo "ab:abc" >expected &&
279
+ echo "${HC}ab:abc" >expected &&
280
git \
281
-c grep.patternType=default \
282
-c grep.extendedRegexp=true \
283
- grep "a+b*c" ab >actual &&
283
+ grep "a+b*c" $H ab >actual &&
284
test_cmp expected actual
285
'
286
287
test_expect_success "grep $L with grep.extendedRegexp=true and grep.patternType=default" '
288
- echo "ab:abc" >expected &&
288
+ echo "${HC}ab:abc" >expected &&
289
git \
290
-c grep.extendedRegexp=true \
291
-c grep.patternType=default \
292
- grep "a+b*c" ab >actual &&
292
+ grep "a+b*c" $H ab >actual &&
293
test_cmp expected actual
294
'
295
296
- test_expect_success 'grep $L with grep.patternType=extended and grep.extendedRegexp=false' '
297
- echo "ab:abc" >expected &&
296
+ test_expect_success "grep $L with grep.patternType=extended and grep.extendedRegexp=false" '
297
+ echo "${HC}ab:abc" >expected &&
298
git \
299
-c grep.patternType=extended \
300
-c grep.extendedRegexp=false \
301
- grep "a+b*c" ab >actual &&
301
+ grep "a+b*c" $H ab >actual &&
302
test_cmp expected actual
303
'
304
305
- test_expect_success 'grep $L with grep.patternType=basic and grep.extendedRegexp=true' '
306
- echo "ab:a+bc" >expected &&
305
+ test_expect_success "grep $L with grep.patternType=basic and grep.extendedRegexp=true" '
306
+ echo "${HC}ab:a+bc" >expected &&
307
git \
308
-c grep.patternType=basic \
309
-c grep.extendedRegexp=true \
310
- grep "a+b*c" ab >actual &&
310
+ grep "a+b*c" $H ab >actual &&
311
test_cmp expected actual
312
'
313
314
- test_expect_success 'grep $L with grep.extendedRegexp=false and grep.patternType=extended' '
315
- echo "ab:abc" >expected &&
314
+ test_expect_success "grep $L with grep.extendedRegexp=false and grep.patternType=extended" '
315
+ echo "${HC}ab:abc" >expected &&
316
git \
317
-c grep.extendedRegexp=false \
318
-c grep.patternType=extended \
319
- grep "a+b*c" ab >actual &&
319
+ grep "a+b*c" $H ab >actual &&
320
test_cmp expected actual
321
'
322
323
- test_expect_success 'grep $L with grep.extendedRegexp=true and grep.patternType=basic' '
324
- echo "ab:a+bc" >expected &&
323
+ test_expect_success "grep $L with grep.extendedRegexp=true and grep.patternType=basic" '
324
+ echo "${HC}ab:a+bc" >expected &&
325
git \
326
-c grep.extendedRegexp=true \
327
-c grep.patternType=basic \
328
- grep "a+b*c" ab >actual &&
328
+ grep "a+b*c" $H ab >actual &&
329
test_cmp expected actual
330
'
331
done