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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Aug 13, 2010 at 20:40 UTC
f2f7b6a550008151a1d312b058c853cd7a61f9ab
4 files changed
+23
-28
t/lib-patch-mode.sh
-5
@@ -2,11 +2,6 @@
2
3
. ./test-lib.sh
4
5
-if ! test_have_prereq PERL; then
6
- skip_all='skipping --patch tests, perl not available'
7
- test_done
8
-fi
9
-
5
set_state () {
6
echo "$3" > "$1" &&
7
git add "$1" &&
t/t2016-checkout-patch.sh
+14
-14
@@ -4,7 +4,7 @@ test_description='git checkout --patch'
4
5
. ./lib-patch-mode.sh
6
7
-test_expect_success 'setup' '
7
+test_expect_success PERL 'setup' '
8
mkdir dir &&
9
echo parent > dir/foo &&
10
echo dummy > bar &&
@@ -18,40 +18,40 @@ test_expect_success 'setup' '
18
19
# note: bar sorts before dir/foo, so the first 'n' is always to skip 'bar'
20
21
-test_expect_success 'saying "n" does nothing' '
21
+test_expect_success PERL 'saying "n" does nothing' '
22
set_and_save_state dir/foo work head &&
23
(echo n; echo n) | git checkout -p &&
24
verify_saved_state bar &&
25
verify_saved_state dir/foo
26
'
27
28
-test_expect_success 'git checkout -p' '
28
+test_expect_success PERL 'git checkout -p' '
29
(echo n; echo y) | git checkout -p &&
30
verify_saved_state bar &&
31
verify_state dir/foo head head
32
'
33
34
-test_expect_success 'git checkout -p with staged changes' '
34
+test_expect_success PERL 'git checkout -p with staged changes' '
35
set_state dir/foo work index
36
(echo n; echo y) | git checkout -p &&
37
verify_saved_state bar &&
38
verify_state dir/foo index index
39
'
40
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' '
42
set_and_save_state dir/foo work head &&
43
(echo n; echo y; echo n) | git checkout -p HEAD &&
44
verify_saved_state bar &&
45
verify_saved_state dir/foo
46
'
47
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' '
49
(echo n; echo y; echo y) | git checkout -p HEAD &&
50
verify_saved_state bar &&
51
verify_state dir/foo head head
52
'
53
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' '
55
set_state dir/foo index index
56
# the third n is to get out in case it mistakenly does not apply
57
(echo n; echo y; echo n) | git checkout -p HEAD &&
@@ -59,14 +59,14 @@ test_expect_success 'git checkout -p HEAD with change already staged' '
59
verify_state dir/foo head head
60
'
61
62
-test_expect_success 'git checkout -p HEAD^' '
62
+test_expect_success PERL 'git checkout -p HEAD^' '
63
# the third n is to get out in case it mistakenly does not apply
64
(echo n; echo y; echo n) | git checkout -p HEAD^ &&
65
verify_saved_state bar &&
66
verify_state dir/foo parent parent
67
'
68
69
-test_expect_success 'git checkout -p handles deletion' '
69
+test_expect_success PERL 'git checkout -p handles deletion' '
70
set_state dir/foo work index &&
71
rm dir/foo &&
72
(echo n; echo y) | git checkout -p &&
@@ -79,28 +79,28 @@ test_expect_success 'git checkout -p handles deletion' '
79
# dir/foo. There's always an extra 'n' to reject edits to dir/foo in
80
# the failure case (and thus get out of the loop).
81
82
-test_expect_success 'path limiting works: dir' '
82
+test_expect_success PERL 'path limiting works: dir' '
83
set_state dir/foo work head &&
84
(echo y; echo n) | git checkout -p dir &&
85
verify_saved_state bar &&
86
verify_state dir/foo head head
87
'
88
89
-test_expect_success 'path limiting works: -- dir' '
89
+test_expect_success PERL 'path limiting works: -- dir' '
90
set_state dir/foo work head &&
91
(echo y; echo n) | git checkout -p -- dir &&
92
verify_saved_state bar &&
93
verify_state dir/foo head head
94
'
95
96
-test_expect_success 'path limiting works: HEAD^ -- dir' '
96
+test_expect_success PERL 'path limiting works: HEAD^ -- dir' '
97
# the third n is to get out in case it mistakenly does not apply
98
(echo y; echo n; echo n) | git checkout -p HEAD^ -- dir &&
99
verify_saved_state bar &&
100
verify_state dir/foo parent parent
101
'
102
103
-test_expect_success 'path limiting works: foo inside dir' '
103
+test_expect_success PERL 'path limiting works: foo inside dir' '
104
set_state dir/foo work head &&
105
# the third n is to get out in case it mistakenly does not apply
106
(echo y; echo n; echo n) | (cd dir && git checkout -p foo) &&
@@ -108,7 +108,7 @@ test_expect_success 'path limiting works: foo inside dir' '
108
verify_state dir/foo head head
109
'
110
111
-test_expect_success 'none of this moved HEAD' '
111
+test_expect_success PERL 'none of this moved HEAD' '
112
verify_saved_head
113
'
114
t/t3904-stash-patch.sh
+5
-5
@@ -3,7 +3,7 @@
3
test_description='git checkout --patch'
4
. ./lib-patch-mode.sh
5
6
-test_expect_success 'setup' '
6
+test_expect_success PERL 'setup' '
7
mkdir dir &&
8
echo parent > dir/foo &&
9
echo dummy > bar &&
@@ -19,14 +19,14 @@ test_expect_success 'setup' '
19
20
# note: bar sorts before dir, so the first 'n' is always to skip 'bar'
21
22
-test_expect_success 'saying "n" does nothing' '
22
+test_expect_success PERL 'saying "n" does nothing' '
23
set_state dir/foo work index
24
(echo n; echo n) | test_must_fail git stash save -p &&
25
verify_state dir/foo work index &&
26
verify_saved_state bar
27
'
28
29
-test_expect_success 'git stash -p' '
29
+test_expect_success PERL 'git stash -p' '
30
(echo n; echo y) | git stash save -p &&
31
verify_state dir/foo head index &&
32
verify_saved_state bar &&
@@ -36,7 +36,7 @@ test_expect_success 'git stash -p' '
36
verify_state bar dummy dummy
37
'
38
39
-test_expect_success 'git stash -p --no-keep-index' '
39
+test_expect_success PERL 'git stash -p --no-keep-index' '
40
set_state dir/foo work index &&
41
set_state bar bar_work bar_index &&
42
(echo n; echo y) | git stash save -p --no-keep-index &&
@@ -48,7 +48,7 @@ test_expect_success 'git stash -p --no-keep-index' '
48
verify_state bar dummy bar_index
49
'
50
51
-test_expect_success 'none of this moved HEAD' '
51
+test_expect_success PERL 'none of this moved HEAD' '
52
verify_saved_head
53
'
54
t/t7105-reset-patch.sh
+4
-4
@@ -41,27 +41,27 @@ test_expect_success 'git reset -p HEAD^' '
41
# dir/foo. There's always an extra 'n' to reject edits to dir/foo in
42
# the failure case (and thus get out of the loop).
43
44
-test_expect_success 'git reset -p dir' '
44
+test_expect_success PERL 'git reset -p dir' '
45
set_state dir/foo work work
46
(echo y; echo n) | git reset -p dir &&
47
verify_state dir/foo work head &&
48
verify_saved_state bar
49
'
50
51
-test_expect_success 'git reset -p -- foo (inside dir)' '
51
+test_expect_success PERL 'git reset -p -- foo (inside dir)' '
52
set_state dir/foo work work
53
(echo y; echo n) | (cd dir && git reset -p -- foo) &&
54
verify_state dir/foo work head &&
55
verify_saved_state bar
56
'
57
58
-test_expect_success 'git reset -p HEAD^ -- dir' '
58
+test_expect_success PERL 'git reset -p HEAD^ -- dir' '
59
(echo y; echo n) | git reset -p HEAD^ -- dir &&
60
verify_state dir/foo work parent &&
61
verify_saved_state bar
62
'
63
64
-test_expect_success 'none of this moved HEAD' '
64
+test_expect_success PERL 'none of this moved HEAD' '
65
verify_saved_head
66
'
67