diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-06-20 16:02:24 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-20 16:02:24 -0700 |
commit | 01c0615dceb433a5498c7160d67f77a6cc9197bb (patch) | |
tree | 422612ad3a7e7b0aea14905a815c5d60d5914351 /t/test-lib-functions.sh | |
parent | 0846fe1a8357b0a99b9d547a4d97844048ae2101 (diff) | |
parent | ca8d148daf3014577222c2562ca2c8170a866aa4 (diff) | |
download | git-01c0615dceb433a5498c7160d67f77a6cc9197bb.tar.gz |
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.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index fac9234d3c..8828ff78f1 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 && |