aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2010-11-10 12:36:31 -0800
committerGravatar Carl Worth <cworth@cworth.org>2010-11-11 03:40:19 -0800
commit0b6349d70557589563f6eb2a23c2a1fa1330e54a (patch)
treef987c601557e2d55965fa5b5f77b2392dc20bdeb /test
parent2638fb75653a6cb65b92429c82e27462aeb34fc6 (diff)
test: Rework recently-added additional maildir-sync tests
These needed to be changed to be brought up to the current state of the maildir-sync tests. This includes style changes, but also the elimination of any assumption about pre-existing message filenames, (such as msg-003) which actually don't exist anymore. Also, the known broken tests are changed to emit FAIL rather than BROKEN simply to make them easier to fix, (so that they print the current problems rather than hiding them). Finally, an additional test is added to ensure that when a duplicate file is added without flags, it doesn't invalidate flags from other duplicates, (instead the flags are effectively merged).
Diffstat (limited to 'test')
-rwxr-xr-xtest/maildir-sync42
1 files changed, 26 insertions, 16 deletions
diff --git a/test/maildir-sync b/test/maildir-sync
index 8d38c43d..4a410733 100755
--- a/test/maildir-sync
+++ b/test/maildir-sync
@@ -131,23 +131,33 @@ 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 "Duplicate mail with new flags propagates flag to original file"
+(cd $MAIL_DIR/cur/; ls duplicated*) > actual
+test_expect_equal "$(< actual)" "duplicated-message:2,RS
+duplicated-message-copy:2,RS"
+
+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_done