diff options
author | Mark Anderson <ma.skies@gmail.com> | 2011-06-27 11:12:24 -0600 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2011-06-29 14:10:05 -0700 |
commit | 86e0baeb6df5509393832488c0de3520a1a5bdcb (patch) | |
tree | 138a8b0878c93e15566076916ebfb5d5cb24a7da /test/search-folder-coherence | |
parent | 04b9ffa56f54976f6a3324a3673915a036646ea6 (diff) |
test:Folder tags shouldn't match after removal of file in given folder
Test for bug. Current stemming support for notmuch adds extra terms
to the DB which aren't removed when the file renames are detected.
When folder tags are added to a message, Xapian terms for both XFOLDER
and ZXFOLDER are generated. When one of the filenames are
renamed/removed, only the XFOLDER tags are removed, leaving it possible
for a match on a folder: tag that was previously but is no longer a
match in the maildir.
Diffstat (limited to 'test/search-folder-coherence')
-rwxr-xr-x | test/search-folder-coherence | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/search-folder-coherence b/test/search-folder-coherence new file mode 100755 index 00000000..cf3ba40d --- /dev/null +++ b/test/search-folder-coherence @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +test_description='folder tags removed and added through file renames remain consistent' +. ./test-lib.sh + +test_begin_subtest "No new messages" +output=$(NOTMUCH_NEW) +test_expect_equal "$output" "No new mail." + + +test_begin_subtest "Single new message" +generate_message +file_x=$gen_msg_filename +id_x=$gen_msg_id +output=$(NOTMUCH_NEW) +test_expect_equal "$output" "Added 1 new message to the database." + +test_begin_subtest "Add second folder for same message" +dir=$(dirname $file_x) +mkdir $dir/spam +cp $file_x $dir/spam +output=$(NOTMUCH_NEW) +test_expect_equal "$output" "No new mail." + + +test_begin_subtest "Multiple files for same message" +cat <<EOF >EXPECTED +MAIL_DIR/msg-001 +MAIL_DIR/spam/msg-001 +EOF +notmuch search --output=files id:$id_x | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT +test_expect_equal_file OUTPUT EXPECTED + +test_begin_subtest "Test matches folder:spam" +output=$(notmuch search folder:spam) +test_expect_equal "$output" "thread:0000000000000001 2001-01-05 [1/1] Notmuch Test Suite; Test message #1 (inbox unread)" + +sleep 1; + +test_begin_subtest "Remove folder:spam copy of email" +rm $dir/spam/$(basename $file_x) +output=$(NOTMUCH_NEW) +test_expect_equal "$output" "No new mail. Detected 1 file rename." + +test_begin_subtest "No mails match the folder:spam search" +output=$(notmuch search folder:spam) +test_expect_equal "$output" "" + +test_done |