aboutsummaryrefslogtreecommitdiff
path: root/test/T580-thread-search.sh
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2015-09-19 12:45:42 -0300
committerDavid Bremner <david@tethera.net>2015-11-23 08:08:26 -0400
commitd98c0854b8ed93d0f84962a6d1d5d6c1ebf95a14 (patch)
treedba2047b54aa1b97728837005a463a8f277d9aa6 /test/T580-thread-search.sh
parentbfb709851406255d87e1427b7c94f3204d9ea743 (diff)
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.
Diffstat (limited to 'test/T580-thread-search.sh')
-rwxr-xr-xtest/T580-thread-search.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/T580-thread-search.sh b/test/T580-thread-search.sh
new file mode 100755
index 00000000..6f7106db
--- /dev/null
+++ b/test/T580-thread-search.sh
@@ -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