]> git.notmuchmail.org Git - notmuch/commitdiff
test: sort the output of the "prefix" test in T610-message-property
authorOlivier Taïbi <oli@olitb.net>
Sun, 19 Apr 2020 16:06:19 +0000 (18:06 +0200)
committerDavid Bremner <david@tethera.net>
Fri, 24 Apr 2020 00:31:37 +0000 (21:31 -0300)
This test 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 sort the output.

test/T610-message-property.sh

index 53a0be3bdf3c3cb170ad59fe9c8fc6b9dffa780e..b87742305f506627421c5a577bfff0fe5ab13e36 100755 (executable)
@@ -186,6 +186,18 @@ EXPECT0(notmuch_message_add_property (message, "testkey3", "testvalue3"));
 EXPECT0(notmuch_message_add_property (message, "testkey3", "alice3"));
 print_properties (message, "testkey", FALSE);
 EOF
+# expected: 4 values for testkey1, 3 values for testkey3
+# they are not guaranteed to be sorted, so sort them, leaving the first
+# line '== stdout ==' and the end ('== stderr ==' and whatever error
+# may have been printed) alone
+mv OUTPUT unsorted_OUTPUT
+awk ' NR == 1 { print; next } \
+      NR < 6  { print | "sort"; next } \
+      NR == 6 { close("sort") } \
+      NR < 9  { print | "sort"; next } \
+      NR == 9 { close("sort") } \
+      { print }' unsorted_OUTPUT > OUTPUT
+rm unsorted_OUTPUT
 cat <<'EOF' >EXPECTED
 == stdout ==
 alice