]> git.notmuchmail.org Git - notmuch/blob - test/T385-transactions.sh
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / test / T385-transactions.sh
1 #!/usr/bin/env bash
2 test_description='transactions'
3 . $(dirname "$0")/test-lib.sh || exit 1
4
5 make_shim no-close <<EOF
6 #include <notmuch.h>
7 #include <stdio.h>
8 notmuch_status_t
9 notmuch_database_close (notmuch_database_t *notmuch)
10 {
11   return notmuch_database_begin_atomic (notmuch);
12 }
13 EOF
14
15 for i in `seq 1 1024`
16 do
17     generate_message '[subject]="'"subject $i"'"' \
18                      '[body]="'"body $i"'"'
19 done
20
21 test_begin_subtest "initial new"
22 NOTMUCH_NEW > OUTPUT
23 cat <<EOF > EXPECTED
24 Added 1024 new messages to the database.
25 EOF
26 test_expect_equal_file EXPECTED OUTPUT
27
28 test_begin_subtest "Some changes saved with open transaction"
29 notmuch config set database.autocommit 1000
30 rm -r ${MAIL_DIR}/.notmuch
31 notmuch_with_shim no-close new
32 output=$(notmuch count '*')
33 test_expect_equal "$output" "1000"
34
35 test_done