Merge branch 'fc/show-non-empty-errors-in-test'
[gitweb.git] / t / test-lib-functions.sh
index fac9234d3c688ed588da6844163c5d0e712ba3ab..8828ff78f184a451fb43709771cc39bf17186cfb 100644 (file)
@@ -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 &&