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>

Rohit Ashiwal committed Mar 4, 2019 at 17:37 UTC 21d5ad911032efe99ad4c3c72a8c0b839e29d92c
1 file changed +9
t/test-lib-functions.sh
+9
@@ -593,6 +593,15 @@ test_dir_is_empty () {
593 fi
594 }
595
596 +# Check if the file exists and has a size greater than zero
597 +test_file_not_empty () {
598 + if ! test -s "$1"
599 + then
600 + echo "'$1' is not a non-empty file."
601 + false
602 + fi
603 +}
604 +
605 test_path_is_missing () {
606 if test -e "$1"
607 then