2 test_description="duplicate message ids"
3 . ./test-lib.sh || exit 1
5 add_message '[id]="duplicate"' '[subject]="message 1" [filename]=copy1'
6 add_message '[id]="duplicate"' '[subject]="message 2" [filename]=copy2'
8 test_begin_subtest 'First subject preserved'
10 thread:XXX 2001-01-05 [1/1(2)] Notmuch Test Suite; message 1 (inbox unread)
12 notmuch search id:duplicate | notmuch_search_sanitize > OUTPUT
13 test_expect_equal_file EXPECTED OUTPUT
15 test_begin_subtest 'Search for second subject'
20 notmuch search --output=files subject:'"message 2"' | notmuch_dir_sanitize > OUTPUT
21 test_expect_equal_file EXPECTED OUTPUT
23 add_message '[id]="duplicate"' '[body]="sekrit" [filename]=copy3'
24 test_begin_subtest 'search for body in duplicate file'
30 notmuch search --output=files "sekrit" | notmuch_dir_sanitize > OUTPUT
31 test_expect_equal_file EXPECTED OUTPUT
34 test_begin_subtest 'reindex drops terms in duplicate file'
37 notmuch search --output=files "sekrit" | notmuch_dir_sanitize > OUTPUT
38 test_expect_equal_file EXPECTED OUTPUT
41 test_begin_subtest 'Deleted first duplicate file does not stop notmuch show from working'
42 output=$(notmuch show --body=false --format=json id:duplicate)
48 "'"${MAIL_DIR}"/copy1'",
49 "'"${MAIL_DIR}"/copy2'"
51 "timestamp": 978709435,
52 "date_relative": "2001-01-05",
53 "tags": ["inbox","unread"],
55 "Subject": "message 2",
56 "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
57 "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
58 "Date": "Fri, 05 Jan 2001 15:43:55 +0000"
63 test_expect_equal_json "$output" "$expected"