Skip to content

Commit f79ce8d

Browse files
committed
i18n: use test_i18ngrep and test_i18ncmp in t7502
Signed-off-by: Junio C Hamano <[email protected]>
1 parent 32177ba commit f79ce8d

File tree

1 file changed

+31
-41
lines changed

1 file changed

+31
-41
lines changed

t/t7502-commit.sh

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ check_summary_oneline() {
2222
SUMMARY_POSTFIX="$(git log -1 --pretty='format:%h')"
2323
echo "[$SUMMARY_PREFIX $SUMMARY_POSTFIX] $2" >exp &&
2424

25-
if test_have_prereq C_LOCALE_OUTPUT
26-
then
27-
test_cmp exp act
28-
fi
25+
test_i18ncmp exp act
2926
}
3027

3128
test_expect_success 'output summary format' '
@@ -234,23 +231,19 @@ echo "sample
234231
# Please enter the commit message for your changes. Lines starting
235232
# with '#' will be ignored, and an empty message aborts the commit." >expect
236233

237-
test_expect_success C_LOCALE_OUTPUT 'cleanup commit messages (strip,-F,-e): output' '
238-
test_cmp expect actual
234+
test_expect_success 'cleanup commit messages (strip,-F,-e): output' '
235+
test_i18ncmp expect actual
239236
'
240237

241238
echo "#
242239
# Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
243240
#" >> expect
244241

245-
test_expect_success C_LOCALE_OUTPUT 'author different from committer' '
246-
242+
test_expect_success 'author different from committer' '
247243
echo >>negative &&
248-
git commit -e -m "sample"
249-
head -n 7 .git/COMMIT_EDITMSG >actual
250-
'
251-
252-
test_expect_success C_LOCALE_OUTPUT 'author different from committer: output' '
253-
test_cmp expect actual
244+
test_might_fail git commit -e -m "sample" &&
245+
head -n 7 .git/COMMIT_EDITMSG >actual &&
246+
test_i18ncmp expect actual
254247
'
255248

256249
mv expect expect.tmp
@@ -259,7 +252,7 @@ rm -f expect.tmp
259252
echo "# Committer:
260253
#" >> expect
261254

262-
test_expect_success C_LOCALE_OUTPUT 'committer is automatic' '
255+
test_expect_success 'committer is automatic' '
263256
264257
echo >>negative &&
265258
(
@@ -270,10 +263,7 @@ test_expect_success C_LOCALE_OUTPUT 'committer is automatic' '
270263
) &&
271264
head -n 8 .git/COMMIT_EDITMSG | \
272265
sed "s/^# Committer: .*/# Committer:/" >actual
273-
'
274-
275-
test_expect_success C_LOCALE_OUTPUT 'committer is automatic: output' '
276-
test_cmp expect actual
266+
test_i18ncmp expect actual
277267
'
278268

279269
pwd=`pwd`
@@ -376,78 +366,78 @@ try_commit () {
376366
GIT_EDITOR=.git/FAKE_EDITOR git commit -a $* $use_template &&
377367
case "$use_template" in
378368
'')
379-
! grep "^## Custom template" .git/COMMIT_EDITMSG ;;
369+
test_i18ngrep ! "^## Custom template" .git/COMMIT_EDITMSG ;;
380370
*)
381-
grep "^## Custom template" .git/COMMIT_EDITMSG ;;
371+
test_i18ngrep "^## Custom template" .git/COMMIT_EDITMSG ;;
382372
esac
383373
}
384374

385375
try_commit_status_combo () {
386376

387-
test_expect_success C_LOCALE_OUTPUT 'commit' '
377+
test_expect_success 'commit' '
388378
clear_config commit.status &&
389379
try_commit "" &&
390-
grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
380+
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
391381
'
392382

393-
test_expect_success C_LOCALE_OUTPUT 'commit' '
383+
test_expect_success 'commit' '
394384
clear_config commit.status &&
395385
try_commit "" &&
396-
grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
386+
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
397387
'
398388

399-
test_expect_success C_LOCALE_OUTPUT 'commit --status' '
389+
test_expect_success 'commit --status' '
400390
clear_config commit.status &&
401391
try_commit --status &&
402-
grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
392+
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
403393
'
404394

405-
test_expect_success C_LOCALE_OUTPUT 'commit --no-status' '
395+
test_expect_success 'commit --no-status' '
406396
clear_config commit.status &&
407397
try_commit --no-status &&
408-
! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
398+
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
409399
'
410400

411-
test_expect_success C_LOCALE_OUTPUT 'commit with commit.status = yes' '
401+
test_expect_success 'commit with commit.status = yes' '
412402
clear_config commit.status &&
413403
git config commit.status yes &&
414404
try_commit "" &&
415-
grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
405+
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
416406
'
417407

418-
test_expect_success C_LOCALE_OUTPUT 'commit with commit.status = no' '
408+
test_expect_success 'commit with commit.status = no' '
419409
clear_config commit.status &&
420410
git config commit.status no &&
421411
try_commit "" &&
422-
! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
412+
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
423413
'
424414

425-
test_expect_success C_LOCALE_OUTPUT 'commit --status with commit.status = yes' '
415+
test_expect_success 'commit --status with commit.status = yes' '
426416
clear_config commit.status &&
427417
git config commit.status yes &&
428418
try_commit --status &&
429-
grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
419+
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
430420
'
431421

432-
test_expect_success C_LOCALE_OUTPUT 'commit --no-status with commit.status = yes' '
422+
test_expect_success 'commit --no-status with commit.status = yes' '
433423
clear_config commit.status &&
434424
git config commit.status yes &&
435425
try_commit --no-status &&
436-
! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
426+
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
437427
'
438428

439-
test_expect_success C_LOCALE_OUTPUT 'commit --status with commit.status = no' '
429+
test_expect_success 'commit --status with commit.status = no' '
440430
clear_config commit.status &&
441431
git config commit.status no &&
442432
try_commit --status &&
443-
grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
433+
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
444434
'
445435

446-
test_expect_success C_LOCALE_OUTPUT 'commit --no-status with commit.status = no' '
436+
test_expect_success 'commit --no-status with commit.status = no' '
447437
clear_config commit.status &&
448438
git config commit.status no &&
449439
try_commit --no-status &&
450-
! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
440+
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
451441
'
452442

453443
}

0 commit comments

Comments
 (0)