X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=test%2Ftest-lib.sh;h=833bf5fe6d83ba22de3939cc56720a543c0f87c8;hb=c73e273aaf7410c16a9597a041bd09f49352ced3;hp=2ba224c372f6125cd2b0fe661259a63e8b3f403c;hpb=114b985ba73da16d953f30dddf014be889db6e50;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index 2ba224c3..833bf5fe 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 @@ -529,7 +543,7 @@ notmuch_debug_sanitize () { } notmuch_exception_sanitize () { - perl -pe 's/(A Xapian exception occurred at .*[.]cc?):([0-9]*)/\1:XXX/' + perl -pe 's,(A Xapian exception occurred at) .*?([^/]*[.]cc?):([0-9]*),\1 \2:XXX,' } notmuch_search_sanitize () { @@ -537,7 +551,7 @@ notmuch_search_sanitize () { } notmuch_search_files_sanitize () { - notmuch_dir_sanitize + notmuch_dir_sanitize | sed 's/msg-[0-9][0-9][0-9]/msg-XXX/' } notmuch_dir_sanitize () {