X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2FT670-duplicate-mid.sh;h=c198c506378ca077d75d0213008a373dc5826464;hp=d2f894327c7f50da947ac3f7b742a58285655b1f;hb=a863de1e43ee34f6f5794a2759fdceb287e851aa;hpb=17aebb6e7d18adc85c64e6e716cef6f01f3113f4 diff --git a/test/T670-duplicate-mid.sh b/test/T670-duplicate-mid.sh index d2f89432..c198c506 100755 --- a/test/T670-duplicate-mid.sh +++ b/test/T670-duplicate-mid.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash test_description="duplicate message ids" -. ./test-lib.sh || exit 1 +. $(dirname "$0")/test-lib.sh || exit 1 add_message '[id]="duplicate"' '[subject]="message 1" [filename]=copy1' add_message '[id]="duplicate"' '[subject]="message 2" [filename]=copy2' @@ -13,6 +13,31 @@ EOF notmuch search id:duplicate | notmuch_search_sanitize > OUTPUT test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest 'First subject preserved in notmuch-show (json)' +test_subtest_known_broken +output=$(notmuch show --body=false --format=json id:duplicate | notmuch_json_show_sanitize) +expected='[[[{ + "id": "XXXXX", + "match": true, + "excluded": false, + "filename": [ + "'"${MAIL_DIR}"/copy0'", + "'"${MAIL_DIR}"/copy1'", + "'"${MAIL_DIR}"/copy2'" + ], + "timestamp": 42, + "date_relative": "2001-01-05", + "tags": ["inbox","unread"], + "headers": { + "Subject": "message 1", + "From": "Notmuch Test Suite ", + "To": "Notmuch Test Suite ", + "Date": "GENERATED_DATE" + } + }, +[]]]]' +test_expect_equal_json "$output" "$expected" + test_begin_subtest 'Search for second subject' cat <EXPECTED MAIL_DIR/copy0 @@ -40,6 +65,13 @@ notmuch reindex '*' notmuch search --output=files "sekrit" | notmuch_dir_sanitize > OUTPUT test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest 'reindex choses subject from first filename' +cat < EXPECTED +thread:XXX 2001-01-05 [1/1(3)] Notmuch Test Suite; message 0 (inbox unread) +EOF +notmuch search id:duplicate | notmuch_search_sanitize > OUTPUT +test_expect_equal_file EXPECTED OUTPUT + rm ${MAIL_DIR}/copy0 test_begin_subtest 'Deleted first duplicate file does not stop notmuch show from working' output=$(notmuch show --body=false --format=json id:duplicate |