t0024, t5000: use test_lazy_prereq for UNZIP

This change makes the code smaller and we can put it at the top of the script, its rightful place as setup code. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Jan 6, 2013 at 18:49 UTC 25d3d323633dbf3b8e8fbe209c9054196a202cf7
2 files changed +10 -14
t/t0024-crlf-archive.sh
+5 -7
@@ -5,6 +5,11 @@ test_description='respect crlf in git archive'
5 . ./test-lib.sh
6 GIT_UNZIP=${GIT_UNZIP:-unzip}
7
8 +test_lazy_prereq UNZIP '
9 + "$GIT_UNZIP" -v
10 + test $? -ne 127
11 +'
12 +
13 test_expect_success setup '
14
15 git config core.autocrlf true &&
@@ -26,13 +31,6 @@ test_expect_success 'tar archive' '
31
32 '
33
29 -"$GIT_UNZIP" -v >/dev/null 2>&1
30 -if [ $? -eq 127 ]; then
31 - say "Skipping ZIP test, because unzip was not found"
32 -else
33 - test_set_prereq UNZIP
34 -fi
35 -
34 test_expect_success UNZIP 'zip archive' '
35
36 git archive --format=zip HEAD >test.zip &&
t/t5000-tar-tree.sh
+5 -7
@@ -31,6 +31,11 @@ GUNZIP=${GUNZIP:-gzip -d}
31
32 SUBSTFORMAT=%H%n
33
34 +test_lazy_prereq UNZIP '
35 + "$GIT_UNZIP" -v
36 + test $? -ne 127
37 +'
38 +
39 check_zip() {
40 zipfile=$1.zip
41 listfile=$1.lst
@@ -201,13 +206,6 @@ test_expect_success \
206 test_cmp a/substfile2 g/prefix/a/substfile2
207 '
208
204 -"$GIT_UNZIP" -v >/dev/null 2>&1
205 -if [ $? -eq 127 ]; then
206 - say "Skipping ZIP tests, because unzip was not found"
207 -else
208 - test_set_prereq UNZIP
209 -fi
210 -
209 test_expect_success \
210 'git archive --format=zip' \
211 'git archive --format=zip HEAD >d.zip'