Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 9afad7a

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5f95c9f commit 9afad7a

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

t/t7810-grep.sh

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ do
105105

106106
test_expect_success "grep -w $L (w)" '
107107
: >expected &&
108-
test_must_fail git grep -n -w -e "^w" >actual &&
108+
test_must_fail git grep -n -w -e "^w" $H >actual &&
109109
test_cmp expected actual
110110
'
111111

@@ -240,92 +240,92 @@ do
240240
test_cmp expected actual
241241
'
242242
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 &&
245245
test_cmp expected actual
246246
'
247247

248248
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 &&
251251
test_cmp expected actual
252252
'
253253

254254
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 &&
257257
test_cmp expected actual
258258
'
259259

260260
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 &&
263263
test_cmp expected actual
264264
'
265265

266266
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 &&
269269
test_cmp expected actual
270270
'
271271

272272
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 &&
275275
test_cmp expected actual
276276
'
277277

278278
test_expect_success "grep $L with grep.patternType=default and grep.extendedRegexp=true" '
279-
echo "ab:abc" >expected &&
279+
echo "${HC}ab:abc" >expected &&
280280
git \
281281
-c grep.patternType=default \
282282
-c grep.extendedRegexp=true \
283-
grep "a+b*c" ab >actual &&
283+
grep "a+b*c" $H ab >actual &&
284284
test_cmp expected actual
285285
'
286286

287287
test_expect_success "grep $L with grep.extendedRegexp=true and grep.patternType=default" '
288-
echo "ab:abc" >expected &&
288+
echo "${HC}ab:abc" >expected &&
289289
git \
290290
-c grep.extendedRegexp=true \
291291
-c grep.patternType=default \
292-
grep "a+b*c" ab >actual &&
292+
grep "a+b*c" $H ab >actual &&
293293
test_cmp expected actual
294294
'
295295

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 &&
298298
git \
299299
-c grep.patternType=extended \
300300
-c grep.extendedRegexp=false \
301-
grep "a+b*c" ab >actual &&
301+
grep "a+b*c" $H ab >actual &&
302302
test_cmp expected actual
303303
'
304304

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 &&
307307
git \
308308
-c grep.patternType=basic \
309309
-c grep.extendedRegexp=true \
310-
grep "a+b*c" ab >actual &&
310+
grep "a+b*c" $H ab >actual &&
311311
test_cmp expected actual
312312
'
313313

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 &&
316316
git \
317317
-c grep.extendedRegexp=false \
318318
-c grep.patternType=extended \
319-
grep "a+b*c" ab >actual &&
319+
grep "a+b*c" $H ab >actual &&
320320
test_cmp expected actual
321321
'
322322

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 &&
325325
git \
326326
-c grep.extendedRegexp=true \
327327
-c grep.patternType=basic \
328-
grep "a+b*c" ab >actual &&
328+
grep "a+b*c" $H ab >actual &&
329329
test_cmp expected actual
330330
'
331331
done

0 commit comments

Comments
 (0)