Skip to content

Commit 75424cb

Browse files
committed
test: refactor to use "test_config"
Refactor to use the modern "test_config" test utility instead of manual "git config" as the former provides clean up on test completion. This is a prerequisite to the commits that follow which add to this test file. Signed-off-by: Leon Michalak <[email protected]>
1 parent 4f92a1b commit 75424cb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

t/t4055-diff-context.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,43 +47,43 @@ test_expect_success 'the default number of context lines is 3' '
4747
test_expect_success 'diff.context honored by "log"' '
4848
git log -1 -p >output &&
4949
test_grep ! firstline output &&
50-
git config diff.context 8 &&
50+
test_config diff.context 8 &&
5151
git log -1 -p >output &&
5252
test_grep "^ firstline" output
5353
'
5454

5555
test_expect_success 'The -U option overrides diff.context' '
56-
git config diff.context 8 &&
56+
test_config diff.context 8 &&
5757
git log -U4 -1 >output &&
5858
test_grep ! "^ firstline" output
5959
'
6060

6161
test_expect_success 'diff.context honored by "diff"' '
62-
git config diff.context 8 &&
62+
test_config diff.context 8 &&
6363
git diff >output &&
6464
test_grep "^ firstline" output
6565
'
6666

6767
test_expect_success 'plumbing not affected' '
68-
git config diff.context 8 &&
68+
test_config diff.context 8 &&
6969
git diff-files -p >output &&
7070
test_grep ! "^ firstline" output
7171
'
7272

7373
test_expect_success 'non-integer config parsing' '
74-
git config diff.context no &&
74+
test_config diff.context no &&
7575
test_must_fail git diff 2>output &&
7676
test_grep "bad numeric config value" output
7777
'
7878

7979
test_expect_success 'negative integer config parsing' '
80-
git config diff.context -1 &&
80+
test_config diff.context -1 &&
8181
test_must_fail git diff 2>output &&
8282
test_grep "bad config variable" output
8383
'
8484

8585
test_expect_success '-U0 is valid, so is diff.context=0' '
86-
git config diff.context 0 &&
86+
test_config diff.context 0 &&
8787
git diff >output &&
8888
test_grep "^-ADDED" output &&
8989
test_grep "^+MODIFIED" output

0 commit comments

Comments
 (0)