summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Rohit Ashiwal <rohit.ashiwal265@gmail.com>2019-03-04 17:37:59 +0530
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-03-08 14:21:27 +0900
commit21d5ad911032efe99ad4c3c72a8c0b839e29d92c (patch)
treee48b146c40e167de3ec9caa704b8fe24430ce8ca /t
parentGit 2.21 (diff)
downloadtgif-21d5ad911032efe99ad4c3c72a8c0b839e29d92c.tar.xz
test functions: add function `test_file_not_empty`
Add a helper function to ensure that a given path is a non-empty file, and give an error message when it is not. Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rw-r--r--t/test-lib-functions.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 80402a428f..681c41ba32 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -593,6 +593,15 @@ test_dir_is_empty () {
fi
}
+# Check if the file exists and has a size greater than zero
+test_file_not_empty () {
+ if ! test -s "$1"
+ then
+ echo "'$1' is not a non-empty file."
+ false
+ fi
+}
+
test_path_is_missing () {
if test -e "$1"
then