[PATCH] test/thread-order: continue loop while $parent is number

Subject: [PATCH] test/thread-order: continue loop while $parent is number

Date: Wed, 25 Mar 2015 21:07:40 +0200

To: notmuch@notmuchmail.org

Cc: tomi.ollila@iki.fi

From: Tomi Ollila


Due to possible failure when creating $THREADS data there may
be no 'None' text in the data. If having 'None' in the data
is requirement for the loop to terminate the loop may continue
forever.
Inverting the test to check positive matches for numbers inhibits
this particular problem.
---
 test/T260-thread-order.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/T260-thread-order.sh b/test/T260-thread-order.sh
index 99f58336f225..81566e48c98c 100755
--- a/test/T260-thread-order.sh
+++ b/test/T260-thread-order.sh
@@ -45,7 +45,8 @@ for ((n = 0; n < 4; n++)); do
     while read -a parents; do
         references=""
         parent=${parents[$n]}
-        while [[ $parent != None ]]; do
+        # require $parent to be 'number' for loop to continue
+        while [[ $parent =~ ^[0-9]+$ ]]; do
             references="<m$parent@t$thread> $references"
             parent=${parents[$parent]}
         done
-- 
2.0.0


Thread: