[PATCH v2 2/7] verify during thread-breakage that messages are removed as well

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat Apr 2 07:15:36 PDT 2016


One risk of fixes to the thread-breakage problem is that we could fail
to remove the search term indexes entirely.  These additional subtests
should guard against that.
---
 test/T590-thread-breakage.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/test/T590-thread-breakage.sh b/test/T590-thread-breakage.sh
index 704f504..f3e725c 100755
--- a/test/T590-thread-breakage.sh
+++ b/test/T590-thread-breakage.sh
@@ -17,6 +17,7 @@ To: Bob <bob at example.net>
 Date: Thu, 31 Mar 2016 20:10:00 -0400
 
 This is the first message in the thread.
+Apple
 EOF
 }
 
@@ -32,10 +33,18 @@ To: Alice <alice at example.net>
 Date: Thu, 31 Mar 2016 20:15:00 -0400
 
 This is the second message in the thread.
+Banana
 EOF
 }
 
 
+test_subject_count() {
+    notmuch new >/dev/null
+    test_begin_subtest "${3:-looking for $2 instance of '$1'}"
+    count=$(notmuch count --output=threads "$1")
+    test_expect_equal "$count" "$2"
+}
+
 test_thread_count() {
     notmuch new >/dev/null
     test_begin_subtest "${2:-Expecting $1 thread(s)}"
@@ -47,17 +56,25 @@ test_thread_count 0 'There should be no threads initially'
 
 message_a
 test_thread_count 1 'One message in: one thread'
+test_subject_count apple 1
+test_subject_count banana 0
 
 message_b
 test_thread_count 1 'Second message in the same thread: one thread'
+test_subject_count apple 1
+test_subject_count banana 1
 
 rm -f ${MAIL_DIR}/cur/a
 test_thread_count 1 'First message removed: still only one thread'
+test_subject_count apple 0
+test_subject_count banana 1
 
 message_a
 # this is known to fail (it shows 2 threads) because no "ghost
 # message" was created for message A when it was removed from the
 # index, despite message B still pointing to it.
 test_thread_count 1 'First message reappears: should return to the same thread'
+test_subject_count apple 1
+test_subject_count banana 1
 
 test_done
-- 
2.8.0.rc3



More information about the notmuch mailing list