Skip to content

Commit f2f7b6a

Browse files
avargitster
authored andcommitted
lib-patch-mode tests: change from skip_all=* to prereq skip
Change this test to skip test with test prerequisites, and to do setup work in tests. This improves the skipped statistics on platforms where the test isn't run. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f045931 commit f2f7b6a

File tree

4 files changed

+23
-28
lines changed

4 files changed

+23
-28
lines changed

t/lib-patch-mode.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
. ./test-lib.sh
44

5-
if ! test_have_prereq PERL; then
6-
skip_all='skipping --patch tests, perl not available'
7-
test_done
8-
fi
9-
105
set_state () {
116
echo "$3" > "$1" &&
127
git add "$1" &&

t/t2016-checkout-patch.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_description='git checkout --patch'
44

55
. ./lib-patch-mode.sh
66

7-
test_expect_success 'setup' '
7+
test_expect_success PERL 'setup' '
88
mkdir dir &&
99
echo parent > dir/foo &&
1010
echo dummy > bar &&
@@ -18,55 +18,55 @@ test_expect_success 'setup' '
1818

1919
# note: bar sorts before dir/foo, so the first 'n' is always to skip 'bar'
2020

21-
test_expect_success 'saying "n" does nothing' '
21+
test_expect_success PERL 'saying "n" does nothing' '
2222
set_and_save_state dir/foo work head &&
2323
(echo n; echo n) | git checkout -p &&
2424
verify_saved_state bar &&
2525
verify_saved_state dir/foo
2626
'
2727

28-
test_expect_success 'git checkout -p' '
28+
test_expect_success PERL 'git checkout -p' '
2929
(echo n; echo y) | git checkout -p &&
3030
verify_saved_state bar &&
3131
verify_state dir/foo head head
3232
'
3333

34-
test_expect_success 'git checkout -p with staged changes' '
34+
test_expect_success PERL 'git checkout -p with staged changes' '
3535
set_state dir/foo work index
3636
(echo n; echo y) | git checkout -p &&
3737
verify_saved_state bar &&
3838
verify_state dir/foo index index
3939
'
4040

41-
test_expect_success 'git checkout -p HEAD with NO staged changes: abort' '
41+
test_expect_success PERL 'git checkout -p HEAD with NO staged changes: abort' '
4242
set_and_save_state dir/foo work head &&
4343
(echo n; echo y; echo n) | git checkout -p HEAD &&
4444
verify_saved_state bar &&
4545
verify_saved_state dir/foo
4646
'
4747

48-
test_expect_success 'git checkout -p HEAD with NO staged changes: apply' '
48+
test_expect_success PERL 'git checkout -p HEAD with NO staged changes: apply' '
4949
(echo n; echo y; echo y) | git checkout -p HEAD &&
5050
verify_saved_state bar &&
5151
verify_state dir/foo head head
5252
'
5353

54-
test_expect_success 'git checkout -p HEAD with change already staged' '
54+
test_expect_success PERL 'git checkout -p HEAD with change already staged' '
5555
set_state dir/foo index index
5656
# the third n is to get out in case it mistakenly does not apply
5757
(echo n; echo y; echo n) | git checkout -p HEAD &&
5858
verify_saved_state bar &&
5959
verify_state dir/foo head head
6060
'
6161

62-
test_expect_success 'git checkout -p HEAD^' '
62+
test_expect_success PERL 'git checkout -p HEAD^' '
6363
# the third n is to get out in case it mistakenly does not apply
6464
(echo n; echo y; echo n) | git checkout -p HEAD^ &&
6565
verify_saved_state bar &&
6666
verify_state dir/foo parent parent
6767
'
6868

69-
test_expect_success 'git checkout -p handles deletion' '
69+
test_expect_success PERL 'git checkout -p handles deletion' '
7070
set_state dir/foo work index &&
7171
rm dir/foo &&
7272
(echo n; echo y) | git checkout -p &&
@@ -79,36 +79,36 @@ test_expect_success 'git checkout -p handles deletion' '
7979
# dir/foo. There's always an extra 'n' to reject edits to dir/foo in
8080
# the failure case (and thus get out of the loop).
8181

82-
test_expect_success 'path limiting works: dir' '
82+
test_expect_success PERL 'path limiting works: dir' '
8383
set_state dir/foo work head &&
8484
(echo y; echo n) | git checkout -p dir &&
8585
verify_saved_state bar &&
8686
verify_state dir/foo head head
8787
'
8888

89-
test_expect_success 'path limiting works: -- dir' '
89+
test_expect_success PERL 'path limiting works: -- dir' '
9090
set_state dir/foo work head &&
9191
(echo y; echo n) | git checkout -p -- dir &&
9292
verify_saved_state bar &&
9393
verify_state dir/foo head head
9494
'
9595

96-
test_expect_success 'path limiting works: HEAD^ -- dir' '
96+
test_expect_success PERL 'path limiting works: HEAD^ -- dir' '
9797
# the third n is to get out in case it mistakenly does not apply
9898
(echo y; echo n; echo n) | git checkout -p HEAD^ -- dir &&
9999
verify_saved_state bar &&
100100
verify_state dir/foo parent parent
101101
'
102102

103-
test_expect_success 'path limiting works: foo inside dir' '
103+
test_expect_success PERL 'path limiting works: foo inside dir' '
104104
set_state dir/foo work head &&
105105
# the third n is to get out in case it mistakenly does not apply
106106
(echo y; echo n; echo n) | (cd dir && git checkout -p foo) &&
107107
verify_saved_state bar &&
108108
verify_state dir/foo head head
109109
'
110110

111-
test_expect_success 'none of this moved HEAD' '
111+
test_expect_success PERL 'none of this moved HEAD' '
112112
verify_saved_head
113113
'
114114

t/t3904-stash-patch.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
test_description='git checkout --patch'
44
. ./lib-patch-mode.sh
55

6-
test_expect_success 'setup' '
6+
test_expect_success PERL 'setup' '
77
mkdir dir &&
88
echo parent > dir/foo &&
99
echo dummy > bar &&
@@ -19,14 +19,14 @@ test_expect_success 'setup' '
1919

2020
# note: bar sorts before dir, so the first 'n' is always to skip 'bar'
2121

22-
test_expect_success 'saying "n" does nothing' '
22+
test_expect_success PERL 'saying "n" does nothing' '
2323
set_state dir/foo work index
2424
(echo n; echo n) | test_must_fail git stash save -p &&
2525
verify_state dir/foo work index &&
2626
verify_saved_state bar
2727
'
2828

29-
test_expect_success 'git stash -p' '
29+
test_expect_success PERL 'git stash -p' '
3030
(echo n; echo y) | git stash save -p &&
3131
verify_state dir/foo head index &&
3232
verify_saved_state bar &&
@@ -36,7 +36,7 @@ test_expect_success 'git stash -p' '
3636
verify_state bar dummy dummy
3737
'
3838

39-
test_expect_success 'git stash -p --no-keep-index' '
39+
test_expect_success PERL 'git stash -p --no-keep-index' '
4040
set_state dir/foo work index &&
4141
set_state bar bar_work bar_index &&
4242
(echo n; echo y) | git stash save -p --no-keep-index &&
@@ -48,7 +48,7 @@ test_expect_success 'git stash -p --no-keep-index' '
4848
verify_state bar dummy bar_index
4949
'
5050

51-
test_expect_success 'none of this moved HEAD' '
51+
test_expect_success PERL 'none of this moved HEAD' '
5252
verify_saved_head
5353
'
5454

t/t7105-reset-patch.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,27 @@ test_expect_success 'git reset -p HEAD^' '
4141
# dir/foo. There's always an extra 'n' to reject edits to dir/foo in
4242
# the failure case (and thus get out of the loop).
4343

44-
test_expect_success 'git reset -p dir' '
44+
test_expect_success PERL 'git reset -p dir' '
4545
set_state dir/foo work work
4646
(echo y; echo n) | git reset -p dir &&
4747
verify_state dir/foo work head &&
4848
verify_saved_state bar
4949
'
5050

51-
test_expect_success 'git reset -p -- foo (inside dir)' '
51+
test_expect_success PERL 'git reset -p -- foo (inside dir)' '
5252
set_state dir/foo work work
5353
(echo y; echo n) | (cd dir && git reset -p -- foo) &&
5454
verify_state dir/foo work head &&
5555
verify_saved_state bar
5656
'
5757

58-
test_expect_success 'git reset -p HEAD^ -- dir' '
58+
test_expect_success PERL 'git reset -p HEAD^ -- dir' '
5959
(echo y; echo n) | git reset -p HEAD^ -- dir &&
6060
verify_state dir/foo work parent &&
6161
verify_saved_state bar
6262
'
6363

64-
test_expect_success 'none of this moved HEAD' '
64+
test_expect_success PERL 'none of this moved HEAD' '
6565
verify_saved_head
6666
'
6767

0 commit comments

Comments
 (0)