summaryrefslogtreecommitdiff
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-06-20 23:02:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-06-20 23:02:24 (GMT)
commit01c0615dceb433a5498c7160d67f77a6cc9197bb (patch)
tree422612ad3a7e7b0aea14905a815c5d60d5914351 /t/test-lib-functions.sh
parent0846fe1a8357b0a99b9d547a4d97844048ae2101 (diff)
parentca8d148daf3014577222c2562ca2c8170a866aa4 (diff)
downloadgit-01c0615dceb433a5498c7160d67f77a6cc9197bb.zip
git-01c0615dceb433a5498c7160d67f77a6cc9197bb.tar.gz
git-01c0615dceb433a5498c7160d67f77a6cc9197bb.tar.bz2
Merge branch 'fc/show-non-empty-errors-in-test'
* fc/show-non-empty-errors-in-test: test: test_must_be_empty helper
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index fac9234..8828ff7 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -609,6 +609,18 @@ test_cmp() {
$GIT_TEST_CMP "$@"
}
+# Check if the file expected to be empty is indeed empty, and barfs
+# otherwise.
+
+test_must_be_empty () {
+ if test -s "$1"
+ then
+ echo "'$1' is not empty, it contains:"
+ cat "$1"
+ return 1
+ fi
+}
+
# Tests that its two parameters refer to the same revision
test_cmp_rev () {
git rev-parse --verify "$1" >expect.rev &&