X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Fmaildir-sync;h=50a5b8e617b17a59a66ca4a1356e550c1736d7b1;hp=8d38c43da44b1a123bf0b753cb150b4498344802;hb=96d99c383785dec67443ff1b45e2d2f8437398fa;hpb=2638fb75653a6cb65b92429c82e27462aeb34fc6 diff --git a/test/maildir-sync b/test/maildir-sync index 8d38c43d..50a5b8e6 100755 --- a/test/maildir-sync +++ b/test/maildir-sync @@ -12,11 +12,6 @@ filter_show_json() { echo } -cat >> "$NOTMUCH_CONFIG" </dev/null @@ -131,23 +141,38 @@ notmuch restore dump.txt output=$(ls $MAIL_DIR/cur) test_expect_equal "$output" "$expected" -test_begin_subtest 'Duplicated message is tagged according to the duplicate' -cp "$MAIL_DIR/cur/msg-003" "$MAIL_DIR/cur/msg-003-dup:2,RS" -increment_mtime $MAIL_DIR/cur +test_begin_subtest 'Adding flags to duplicate message tags the mail' +add_message [subject]='"Duplicated message"' [dir]=cur [filename]='duplicated-message:2,' +cp "$MAIL_DIR/cur/duplicated-message:2," "$MAIL_DIR/cur/duplicated-message-copy:2,RS" +increment_mtime $MAIL_DIR/cur +NOTMUCH_NEW > output +notmuch search subject:"Duplicated message" | notmuch_search_sanitize >> output +test_expect_equal "$(< output)" "No new mail. +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Duplicated message (inbox replied)" + +test_begin_subtest "Adding duplicate message without flags does not remove tags" +cp "$MAIL_DIR/cur/duplicated-message-copy:2,RS" "$MAIL_DIR/cur/duplicated-message-another-copy:2," +increment_mtime $MAIL_DIR/cur NOTMUCH_NEW > output -notmuch search id:msg-003@notmuch-test-suite | notmuch_search_sanitize >> output +notmuch search subject:"Duplicated message" | notmuch_search_sanitize >> output test_expect_equal "$(< output)" "No new mail. -thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test message 3 (inbox replied tmp)" - -test_begin_subtest 'The original message receives the same flags as the duplicate' -ls $MAIL_DIR/cur > actual -test_expect_equal_failure "$(< actual)" "msg-003:2,RS -msg-003-dup:2,RS" - -test_begin_subtest 'Tagging modifies flags of both the original and the duplicate' -notmuch tag -replied id:msg-003@notmuch-test-suite -ls $MAIL_DIR/cur > actual -test_expect_equal_failure "$(< actual)" "msg-003:2,S -msg-003-dup:2,S" +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Duplicated message (inbox replied)" + +test_begin_subtest "Tag changes modify flags of multiple files" +notmuch tag -replied subject:"Duplicated message" +(cd $MAIL_DIR/cur/; ls duplicated*) > actual +test_expect_equal "$(< actual)" "duplicated-message-another-copy:2,S +duplicated-message-copy:2,S +duplicated-message:2,S" + +test_begin_subtest "Synchronizing tag changes preserves unsupported maildir flags" +add_message [subject]='"Unsupported maildir flags"' [dir]=cur [filename]='unsupported-maildir-flags:2,FSZxyz' +notmuch tag +unread +draft -flagged subject:"Unsupported maildir flags" +test_expect_equal "$(cd $MAIL_DIR/cur/; ls unsupported*)" "unsupported-maildir-flags:2,DZxyz" + +test_begin_subtest "A file with non-compliant maildir info will not be renamed" +add_message [subject]='"Non-compliant maildir info"' [dir]=cur [filename]='non-compliant-maildir-info:2,These-are-not-flags-in-ASCII-order-donottouch' +notmuch tag +unread +draft -flagged subject:"Non-compliant maildir info" +test_expect_equal "$(cd $MAIL_DIR/cur/; ls non-compliant*)" "non-compliant-maildir-info:2,These-are-not-flags-in-ASCII-order-donottouch" test_done