]> git.notmuchmail.org Git - notmuch/blob - test/compact
changelog stanza for 0.17-4
[notmuch] / test / compact
1 #!/usr/bin/env bash
2 test_description='"notmuch compact"'
3 . ./test-lib.sh
4
5 add_message '[subject]=One'
6 add_message '[subject]=Two'
7 add_message '[subject]=Three'
8
9 notmuch tag +tag1 \*
10 notmuch tag +tag2 subject:Two
11 notmuch tag -tag1 +tag3 subject:Three
12
13 test_expect_success "Running compact" "notmuch compact --backup=${TEST_DIRECTORY}/xapian.old"
14
15 test_begin_subtest "Compact preserves database"
16 output=$(notmuch search \* | notmuch_search_sanitize)
17 test_expect_equal "$output" "\
18 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 unread)
19 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag2 unread)
20 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Three (inbox tag3 unread)"
21
22 test_expect_success 'Restoring Backup' \
23     'rm -Rf ${MAIL_DIR}/.notmuch/xapian &&
24      mv ${TEST_DIRECTORY}/xapian.old ${MAIL_DIR}/.notmuch/xapian'
25
26 test_begin_subtest "Checking restored backup"
27 output=$(notmuch search \* | notmuch_search_sanitize)
28 test_expect_equal "$output" "\
29 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 unread)
30 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag2 unread)
31 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Three (inbox tag3 unread)"
32
33 test_done