]> git.notmuchmail.org Git - notmuch/blob - test/T670-duplicate-mid.sh
add "notmuch reindex" subcommand
[notmuch] / test / T670-duplicate-mid.sh
1 #!/usr/bin/env bash
2 test_description="duplicate message ids"
3 . ./test-lib.sh || exit 1
4
5 add_message '[id]="duplicate"' '[subject]="message 1" [filename]=copy1'
6 add_message '[id]="duplicate"' '[subject]="message 2" [filename]=copy2'
7
8 test_begin_subtest 'First subject preserved'
9 cat <<EOF > EXPECTED
10 thread:XXX   2001-01-05 [1/1(2)] Notmuch Test Suite; message 1 (inbox unread)
11 EOF
12 notmuch search id:duplicate | notmuch_search_sanitize > OUTPUT
13 test_expect_equal_file EXPECTED OUTPUT
14
15 test_begin_subtest 'Search for second subject'
16 cat <<EOF >EXPECTED
17 MAIL_DIR/copy1
18 MAIL_DIR/copy2
19 EOF
20 notmuch search --output=files subject:'"message 2"' | notmuch_dir_sanitize > OUTPUT
21 test_expect_equal_file EXPECTED OUTPUT
22
23 add_message '[id]="duplicate"' '[body]="sekrit" [filename]=copy3'
24 test_begin_subtest 'search for body in duplicate file'
25 cat <<EOF >EXPECTED
26 MAIL_DIR/copy1
27 MAIL_DIR/copy2
28 MAIL_DIR/copy3
29 EOF
30 notmuch search --output=files "sekrit" | notmuch_dir_sanitize > OUTPUT
31 test_expect_equal_file EXPECTED OUTPUT
32
33 rm ${MAIL_DIR}/copy3
34 test_begin_subtest 'reindex drops terms in duplicate file'
35 cp /dev/null EXPECTED
36 notmuch reindex '*'
37 notmuch search --output=files "sekrit" | notmuch_dir_sanitize > OUTPUT
38 test_expect_equal_file EXPECTED OUTPUT
39
40 test_done