[PATCH] test: sort the output of the "prefix" test in T610-message-property as needed

Subject: [PATCH] test: sort the output of the "prefix" test in T610-message-property as needed

Date: Fri, 17 Apr 2020 23:13:56 +0200

To: notmuch@notmuchmail.org

Cc:

From: Olivier Taïbi


the "prefix" test in T610-message-property extracts values from a
(key,value) map where multiple entries can have the same key, and the
entries are sorted by key, but not by value.  The test incorrectly
assumes that the values will be sorted as well, so correct this by
splitting the output using head and tail and sorting each chunk using
sort.
NB: the relevant key/values are as follows.
testkey1: alice, testvalue1, testvalue2, bob
testkey3: alice3, bob3, testvalue3
---
 test/T610-message-property.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh
index 53a0be3b..e1be2fc3 100755
--- a/test/T610-message-property.sh
+++ b/test/T610-message-property.sh
@@ -186,6 +186,11 @@ EXPECT0(notmuch_message_add_property (message, "testkey3", "testvalue3"));
 EXPECT0(notmuch_message_add_property (message, "testkey3", "alice3"));
 print_properties (message, "testkey", FALSE);
 EOF
+mv OUTPUT unsorted_OUTPUT
+head -n 5 unsorted_OUTPUT | sort >OUTPUT
+tail -n +6 unsorted_OUTPUT | head -n 3 | sort >>OUTPUT
+tail -n +9 unsorted_OUTPUT >>OUTPUT
+rm unsorted_OUTPUT
 cat <<'EOF' >EXPECTED
 == stdout ==
 alice
-- 
2.26.0

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: