X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=test%2Ftest-lib.sh;h=af017ec222fe516d308db08327eaf364e91d86e0;hb=303f207a54325158105aba400702637e670decda;hp=f1275b85eca9ec428d5748577f2a5255445d952b;hpb=f9d8f9c6bae1a9ea60b41755008b71381464e208;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index f1275b85..af017ec2 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -432,6 +432,20 @@ test_expect_equal_file () { test_diff_file_ "$1" "$2" } +# Like test_expect_equal_file, but compare the part of the two files after the first blank line +test_expect_equal_message_body () { + exec 1>&6 2>&7 # Restore stdout and stderr + if [ -z "$inside_subtest" ]; then + error "bug in the test script: test_expect_equal_file without test_begin_subtest" + fi + test "$#" = 2 || + error "bug in the test script: not 2 parameters to test_expect_equal_file" + + expected=$(sed '1,/^$/d' "$1") + output=$(sed '1,/^$/d' "$2") + test_expect_equal "$expected" "$output" +} + # Like test_expect_equal, but takes two filenames. Fails if either is empty test_expect_equal_file_nonempty () { exec 1>&6 2>&7 # Restore stdout and stderr