Skip to content

Commit 8feb47e

Browse files
committed
Merge branch 'dl/t5520-cleanup'
Test cleanup. * dl/t5520-cleanup: t5520: replace `! git` with `test_must_fail git` t5520: remove redundant lines in test cases t5520: replace $(cat ...) comparison with test_cmp t5520: don't put git in upstream of pipe t5520: test single-line files by git with test_cmp t5520: use test_cmp_rev where possible t5520: replace test -{n,z} with test-lib functions t5520: use test_line_count where possible t5520: remove spaces after redirect operator t5520: replace test -f with test-lib functions t5520: let sed open its own input t5520: use sq for test case names t5520: improve test style t: teach test_cmp_rev to accept ! for not-equals t0000: test multiple local assignment
2 parents 6b3cb32 + 2a02262 commit 8feb47e

10 files changed

+238
-159
lines changed

t/t0000-basic.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ modification *should* take notice and update the test vectors here.
2020

2121
. ./test-lib.sh
2222

23-
try_local_x () {
24-
local x="local" &&
25-
echo "$x"
23+
try_local_xy () {
24+
local x="local" y="alsolocal" &&
25+
echo "$x $y"
2626
}
2727

2828
# Check whether the shell supports the "local" keyword. "local" is not
@@ -35,11 +35,12 @@ try_local_x () {
3535
# relying on "local".
3636
test_expect_success 'verify that the running shell supports "local"' '
3737
x="notlocal" &&
38-
echo "local" >expected1 &&
39-
try_local_x >actual1 &&
38+
y="alsonotlocal" &&
39+
echo "local alsolocal" >expected1 &&
40+
try_local_xy >actual1 &&
4041
test_cmp expected1 actual1 &&
41-
echo "notlocal" >expected2 &&
42-
echo "$x" >actual2 &&
42+
echo "notlocal alsonotlocal" >expected2 &&
43+
echo "$x $y" >actual2 &&
4344
test_cmp expected2 actual2
4445
'
4546

t/t2400-worktree-add.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ test_expect_success 'git worktree add does not match remote' '
438438
cd foo &&
439439
test_must_fail git config "branch.foo.remote" &&
440440
test_must_fail git config "branch.foo.merge" &&
441-
! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo
441+
test_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo
442442
)
443443
'
444444

@@ -483,7 +483,7 @@ test_expect_success 'git worktree --no-guess-remote option overrides config' '
483483
cd foo &&
484484
test_must_fail git config "branch.foo.remote" &&
485485
test_must_fail git config "branch.foo.merge" &&
486-
! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo
486+
test_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo
487487
)
488488
'
489489

t/t3400-rebase.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ test_expect_success 'rebase sets ORIG_HEAD to pre-rebase state' '
6464
pre="$(git rev-parse --verify HEAD)" &&
6565
git rebase master &&
6666
test_cmp_rev "$pre" ORIG_HEAD &&
67-
! test_cmp_rev "$pre" HEAD
67+
test_cmp_rev ! "$pre" HEAD
6868
'
6969

7070
test_expect_success 'rebase, with <onto> and <upstream> specified as :/quuxery' '

t/t3421-rebase-topology-linear.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ test_run_rebase () {
6161
test_expect_$result "rebase $* -f rewrites even if upstream is an ancestor" "
6262
reset_rebase &&
6363
git rebase $* -f b e &&
64-
! test_cmp_rev e HEAD &&
64+
test_cmp_rev ! e HEAD &&
6565
test_cmp_rev b HEAD~2 &&
6666
test_linear_range 'd e' b..
6767
"
@@ -78,7 +78,7 @@ test_run_rebase () {
7878
test_expect_$result "rebase $* -f rewrites even if remote upstream is an ancestor" "
7979
reset_rebase &&
8080
git rebase $* -f branch-b branch-e &&
81-
! test_cmp_rev branch-e origin/branch-e &&
81+
test_cmp_rev ! branch-e origin/branch-e &&
8282
test_cmp_rev branch-b HEAD~2 &&
8383
test_linear_range 'd e' branch-b..
8484
"
@@ -368,7 +368,7 @@ test_run_rebase () {
368368
test_expect_$result "rebase $* -f --root on linear history causes re-write" "
369369
reset_rebase &&
370370
git rebase $* -f --root c &&
371-
! test_cmp_rev a HEAD~2 &&
371+
test_cmp_rev ! a HEAD~2 &&
372372
test_linear_range 'a b c' HEAD
373373
"
374374
}

t/t3430-rebase-merges.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ test_expect_success 'A root commit can be a cousin, treat it that way' '
346346
git merge --allow-unrelated-histories khnum &&
347347
test_tick &&
348348
git rebase -f -r HEAD^ &&
349-
! test_cmp_rev HEAD^2 khnum &&
349+
test_cmp_rev ! HEAD^2 khnum &&
350350
test_cmp_graph HEAD^.. <<-\EOF &&
351351
* Merge branch '\''khnum'\'' into asherah
352352
|\

t/t3432-rebase-fast-forward.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ test_rebase_same_head_ () {
6464
test_cmp_rev \$oldhead \$newhead
6565
elif test $cmp = diff
6666
then
67-
! test_cmp_rev \$oldhead \$newhead
67+
test_cmp_rev ! \$oldhead \$newhead
6868
fi
6969
"
7070
}

t/t3501-revert-cherry-pick.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ test_expect_success 'cherry-pick on unborn branch' '
106106
rm -rf * &&
107107
git cherry-pick initial &&
108108
git diff --quiet initial &&
109-
! test_cmp_rev initial HEAD
109+
test_cmp_rev ! initial HEAD
110110
'
111111

112112
test_expect_success 'cherry-pick "-" to pick from previous branch' '

t/t3508-cherry-pick-many-commits.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test_description='test cherry-picking many commits'
55
. ./test-lib.sh
66

77
check_head_differs_from() {
8-
! test_cmp_rev HEAD "$1"
8+
test_cmp_rev ! HEAD "$1"
99
}
1010

1111
check_head_equals() {

0 commit comments

Comments
 (0)