[PATCH v2 1/4] archive: follow test standards around assertions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move assertions outside of the check_tar function so that all top-level
code is wrapped in a test_expect_* assertion.

Signed-off-by: Josh Steadmon <steadmon@xxxxxxxxxx>
---
 t/t5000-tar-tree.sh | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 2a97b27b0a..c408e3a23d 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -62,11 +62,9 @@ check_tar() {
 	dir=$1
 	dir_with_prefix=$dir/$2
 
-	test_expect_success ' extract tar archive' '
-		(mkdir $dir && cd $dir && "$TAR" xf -) <$tarfile
-	'
+	(mkdir $dir && cd $dir && "$TAR" xf -) <$tarfile &&
 
-	test_expect_success TAR_NEEDS_PAX_FALLBACK ' interpret pax headers' '
+	if test_have_prereq TAR_NEEDS_PAX_FALLBACK ; then
 		(
 			cd $dir &&
 			for header in *.paxheader
@@ -82,16 +80,11 @@ check_tar() {
 				fi
 			done
 		)
-	'
+	fi &&
 
-	test_expect_success ' validate filenames' '
-		(cd ${dir_with_prefix}a && find .) | sort >$listfile &&
-		test_cmp a.lst $listfile
-	'
-
-	test_expect_success ' validate file contents' '
-		diff -r a ${dir_with_prefix}a
-	'
+	(cd ${dir_with_prefix}a && find .) | sort >$listfile &&
+	test_cmp a.lst $listfile &&
+	diff -r a ${dir_with_prefix}a
 }
 
 test_expect_success \
@@ -143,19 +136,20 @@ test_expect_success \
     'git archive' \
     'git archive HEAD >b.tar'
 
-check_tar b
+test_expect_success 'extract archive' 'check_tar b'
 
 test_expect_success 'git archive --prefix=prefix/' '
 	git archive --prefix=prefix/ HEAD >with_prefix.tar
 '
 
-check_tar with_prefix prefix/
+test_expect_success 'extract with prefix' 'check_tar with_prefix prefix/'
 
 test_expect_success 'git-archive --prefix=olde-' '
 	git archive --prefix=olde- HEAD >with_olde-prefix.tar
 '
 
-check_tar with_olde-prefix olde-
+test_expect_success 'extract with olde- prefix' \
+	'check_tar with_olde-prefix olde-'
 
 test_expect_success 'git archive on large files' '
     test_config core.bigfilethreshold 1 &&
-- 
2.19.0.605.g01d371f741-goog




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux