]> git.notmuchmail.org Git - notmuch/blobdiff - test/T260-thread-order.sh
cli/reindex: destroy stashed session keys when --decrypt=false
[notmuch] / test / T260-thread-order.sh
index b435d79fb0db0712c3479c407e0ac3a03bbaf951..fea612757c41c4675dd3a95deaea6da7e2ef16a0 100755 (executable)
@@ -1,10 +1,10 @@
 #!/usr/bin/env bash
 test_description="threading when messages received out of order"
-. ./test-lib.sh
+. $(dirname "$0")/test-lib.sh || exit 1
 
 # Generate all single-root four message thread structures.  We'll use
 # this for multiple tests below.
-THREADS=$(python ${TEST_DIRECTORY}/gen-threads.py 4)
+THREADS=$($NOTMUCH_PYTHON ${NOTMUCH_SRCDIR}/test/gen-threads.py 4)
 nthreads=$(wc -l <<< "$THREADS")
 
 test_begin_subtest "Messages with one parent get linked in all delivery orders"
@@ -30,7 +30,6 @@ expected=$(for ((i = 0; i < $nthreads; i++)); do
 test_expect_equal "$output" "$expected"
 
 test_begin_subtest "Messages with all parents get linked in all delivery orders"
-test_subtest_known_broken
 # Here we do the same thing as the previous test, but each message
 # references all of its parents.  Since every message references the
 # root of the thread, each thread should always be fully joined.  This
@@ -46,9 +45,12 @@ for ((n = 0; n < 4; n++)); do
     while read -a parents; do
         references=""
         parent=${parents[$n]}
-        while [[ $parent != None ]]; do
+        while [[ ${parent:-None} != None ]]; do
             references="<m$parent@t$thread> $references"
+            pp=$parent
             parent=${parents[$parent]}
+            # Avoid looping over broken input (if ever)
+            parents[$pp]="None"
         done
 
         generate_message \