From: David Bremner <brem...@debian.org> The idea is to generate a random dump file, and then generate minimal mail messages from that.
Currently this relies on the behaviour of the gmime message-id parser that if it cannot find a leading '<' in the Message-Id field, it just copies the string without attempting to parse it. The alternative is to settle for some weaker notion of round-tripping in this test. --- test/dump-restore | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/test/dump-restore b/test/dump-restore index 60ae68e..c354a44 100755 --- a/test/dump-restore +++ b/test/dump-restore @@ -160,4 +160,29 @@ test_begin_subtest 'format=sup, restore=default' notmuch dump --format=sup > OUTPUT.$test_count test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count +test_begin_subtest 'random message-ids and tags' + + count=0 + + ${TEST_DIRECTORY}/random-dump sort > EXPECTED.$test_count + + while read id tags ; do + file=${MAIL_DIR}/cur/dump-$count:2, + count=$((count + 1)) + printf 'From: dump-t...@example.com\n' > ${file} + printf 'To: exam...@example.net\n' > ${file} + printf 'Subject: StrangeMessageIDsAndTags\n' > ${file} + # the missing angle-braces are intentional, since they trigger + # gmime to pass the message-id through unparsed. + printf 'Message-Id: ' >> $file + ${TEST_DIRECTORY}/hex-xcode --direction=decode $id >> $file + done < EXPECTED.$test_count + + notmuch new + notmuch restore < EXPECTED.$test_count + notmuch dump --format=notmuch -- subject:StrangeMessageIDsAndTags | \ + sed 's/ *$//' | sort > OUTPUT.$test_count + +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count + test_done -- 1.7.7.3 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch