notmuch.git  about / heads / tags
Unnamed repository; edit this file 'description' to name the repository.
blob ebd06be1eb8e497883bcbae6c36ef337ed6ec770 1059 bytes (raw)
name: test/T051-new-renames.sh 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 
#!/usr/bin/env bash
test_description='"notmuch new" with directory renames'
. $(dirname "$0")/test-lib.sh || exit 1

for loop in {1..10}; do

rm -rf ${MAIL_DIR}

for i in {1..10}; do
    generate_message '[dir]=foo' '[subject]="Message foo $i"'
done

for i in {1..10}; do
    generate_message '[dir]=bar' '[subject]="Message bar $i"'
done

test_begin_subtest "Index the messages, round $loop"
output=$(NOTMUCH_NEW)
test_expect_equal "$output" "Added 20 new messages to the database."

all_files=$(notmuch search --output=files \*)
count_foo=$(notmuch count folder:foo)

test_begin_subtest "Rename folder"
mv ${MAIL_DIR}/foo ${MAIL_DIR}/baz
output=$(NOTMUCH_NEW)
test_expect_equal "$output" "No new mail. Detected $count_foo file renames."

test_begin_subtest "Rename folder back"
mv ${MAIL_DIR}/baz ${MAIL_DIR}/foo
output=$(NOTMUCH_NEW)
test_expect_equal "$output" "No new mail. Detected $count_foo file renames."

test_begin_subtest "Files remain the same"
output=$(notmuch search --output=files \*)
test_expect_equal "$output" "$all_files"

done

test_done

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

git clone https://yhetil.org/notmuch.git