Skip to content

Commit 21d5ad9

Browse files
r1walzgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8104ec9 commit 21d5ad9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

t/test-lib-functions.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,15 @@ test_dir_is_empty () {
593593
fi
594594
}
595595

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+
596605
test_path_is_missing () {
597606
if test -e "$1"
598607
then

0 commit comments

Comments
 (0)