]> git.cworth.org Git - notmuch/blob - test/T051-new-renames.sh
CLI/git: make existance of config branch optional on clone
[notmuch] / test / T051-new-renames.sh
1 #!/usr/bin/env bash
2 test_description='"notmuch new" with directory renames'
3 . $(dirname "$0")/test-lib.sh || exit 1
4
5 for loop in {1..10}; do
6
7 rm -rf ${MAIL_DIR}
8
9 for i in {1..10}; do
10     generate_message '[dir]=foo' '[subject]="Message foo $i"'
11 done
12
13 for i in {1..10}; do
14     generate_message '[dir]=bar' '[subject]="Message bar $i"'
15 done
16
17 test_begin_subtest "Index the messages, round $loop"
18 output=$(NOTMUCH_NEW)
19 test_expect_equal "$output" "Added 20 new messages to the database."
20
21 all_files=$(notmuch search --output=files \*)
22 count_foo=$(notmuch count folder:foo)
23
24 test_begin_subtest "Rename folder"
25 mv ${MAIL_DIR}/foo ${MAIL_DIR}/baz
26 output=$(NOTMUCH_NEW)
27 test_expect_equal "$output" "No new mail. Detected $count_foo file renames."
28
29 test_begin_subtest "Rename folder back"
30 mv ${MAIL_DIR}/baz ${MAIL_DIR}/foo
31 output=$(NOTMUCH_NEW)
32 test_expect_equal "$output" "No new mail. Detected $count_foo file renames."
33
34 test_begin_subtest "Files remain the same"
35 output=$(notmuch search --output=files \*)
36 test_expect_equal "$output" "$all_files"
37
38 done
39
40 test_done