aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/t0008-threading-out-of-order.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/t0008-threading-out-of-order.sh')
-rwxr-xr-xtest/t0008-threading-out-of-order.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/t0008-threading-out-of-order.sh b/test/t0008-threading-out-of-order.sh
new file mode 100755
index 00000000..9f360b7e
--- /dev/null
+++ b/test/t0008-threading-out-of-order.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+test_description="threading when messages received out of order"
+. ./test-lib.sh
+test_expect_success "Adding initial child message" '
+generate_message [body]=foo "[in-reply-to]=\<parent-id\>" [subject]=brokenthreadtest "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
+output=$(NOTMUCH_NEW) &&
+pass_if_equal "$output" "Added 1 new message to the database."
+'
+test_expect_success "Searching returns the message" '
+output=$($NOTMUCH search foo | notmuch_search_sanitize) &&
+pass_if_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; brokenthreadtest (inbox unread)"
+'
+test_expect_success "Adding second child message" '
+generate_message [body]=foo "[in-reply-to]=\<parent-id\>" [subject]=brokenthreadtest "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
+output=$(NOTMUCH_NEW) &&
+pass_if_equal "$output" "Added 1 new message to the database."
+'
+test_expect_success "Searching returns both messages in one thread" '
+output=$($NOTMUCH search foo | notmuch_search_sanitize) &&
+pass_if_equal "$output" "thread:XXX 2000-01-01 [2/2] Notmuch Test Suite; brokenthreadtest (inbox unread)"
+'
+test_expect_success "Adding parent message" '
+generate_message [body]=foo [id]=parent-id [subject]=brokenthreadtest "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
+output=$(NOTMUCH_NEW) &&
+pass_if_equal "$output" "Added 1 new message to the database."
+'
+test_expect_success "Searching returns all three messages in one thread" '
+output=$($NOTMUCH search foo | notmuch_search_sanitize) &&
+pass_if_equal "$output" "thread:XXX 2000-01-01 [3/3] Notmuch Test Suite; brokenthreadtest (inbox unread)"
+'
+test_done