From: David Bremner Date: Sun, 9 Apr 2023 14:26:24 +0000 (-0300) Subject: test: check for empty/missing files in test_expect_equal_message_body X-Git-Tag: 0.38_rc0~12 X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=f6fcdf12da455d82a9ed0a0a33eddac60253a6e8;p=notmuch test: check for empty/missing files in test_expect_equal_message_body Messages can have empty bodies, but empty files are not messages. --- diff --git a/test/test-lib.sh b/test/test-lib.sh index 1a6525df..f218fa03 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -388,6 +388,14 @@ test_expect_equal_message_body () { test "$#" = 2 || error "bug in the test script: not 2 parameters to test_expect_equal_file" + for file in "$1" "$2"; do + if [ ! -s "$file" ]; then + test_failure_ "Missing or zero length file: $file" + inside_subtest= + return 1 + fi + done + expected=$(sed '1,/^$/d' "$1") output=$(sed '1,/^$/d' "$2") test_expect_equal "$expected" "$output"