mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
test: add sanity tests for threading
These tests are inspired by a problem report id:CAJhTkNh7_hXDLsAGyD7nwkXV4ca6ymkLtFG945USvfqK4ZJEdQ@mail.gmail.com Of course I can't duplicate the mentioned problem, it probably depends on specific message data.
This commit is contained in:
parent
bfb7098514
commit
d98c0854b8
1 changed files with 42 additions and 0 deletions
42
test/T580-thread-search.sh
Executable file
42
test/T580-thread-search.sh
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2015 David Bremner
|
||||
#
|
||||
|
||||
test_description='test of searching by thread-id'
|
||||
|
||||
. ./test-lib.sh || exit 1
|
||||
|
||||
add_email_corpus
|
||||
|
||||
test_begin_subtest "Every message is found in exactly one thread"
|
||||
|
||||
count=0
|
||||
success=0
|
||||
for id in $(notmuch search --output=messages '*'); do
|
||||
count=$((count +1))
|
||||
matches=$(notmuch search --output=threads "$id" | wc -l)
|
||||
if [ "$matches" = 1 ]; then
|
||||
success=$((success + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
test_expect_equal "$count" "$success"
|
||||
|
||||
test_begin_subtest "roundtripping message-ids via thread-ids"
|
||||
|
||||
count=0
|
||||
success=0
|
||||
for id in $(notmuch search --output=messages '*'); do
|
||||
count=$((count +1))
|
||||
thread=$(notmuch search --output=threads "$id")
|
||||
matched=$(notmuch search --output=messages "$thread" | grep "$id")
|
||||
if [ "$matched" = "$id" ]; then
|
||||
success=$((success + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
test_expect_equal "$count" "$success"
|
||||
|
||||
|
||||
test_done
|
Loading…
Reference in a new issue