[PATCH 3/3] WIP/test: extend field grouping tests

Subject: [PATCH 3/3] WIP/test: extend field grouping tests

Date: Wed, 21 Aug 2019 08:41:26 -0300

To: Rollins, Jameson, David Bremner, Jorge P. de Morais Neto, notmuch@notmuchmail.org

Cc:

From: David Bremner


---
 test/T760-implicit-operators.sh | 60 +++++++++++++++++++++++++++------
 1 file changed, 49 insertions(+), 11 deletions(-)

diff --git a/test/T760-implicit-operators.sh b/test/T760-implicit-operators.sh
index 1a6ba61f..438f766f 100755
--- a/test/T760-implicit-operators.sh
+++ b/test/T760-implicit-operators.sh
@@ -2,16 +2,16 @@
 test_description='implicit operators in query parser'
 . $(dirname "$0")/test-lib.sh || exit 1
 
-test_AND() {
-    add_message  "[$1]=a@b"
-    add_message  "[$1]=b@c"
+test_prob_AND() {
+    add_message  "[$1]=alpha@beta"
+    add_message  "[$1]=beta@gamma"
 
-    test_begin_subtest "$1: implicitly joined by AND"
+    test_begin_subtest "probabilistic field '$1:' implicitly joined by AND"
     $2
-    notmuch count $1:a@b > OUTPUT
-    notmuch count $1:a $1:b >> OUTPUT
-    notmuch count $1:a@b OR $1:b@c >> OUTPUT
-    notmuch count $1:a@b $1:b@c >> OUTPUT
+    notmuch count $1:alpha@beta > OUTPUT
+    notmuch count $1:alpha $1:beta >> OUTPUT
+    notmuch count $1:alpha@beta OR $1:beta@gamma >> OUTPUT
+    notmuch count $1:alpha@beta $1:beta@gamma >> OUTPUT
     cat <<EOF > EXPECTED
 1
 1
@@ -21,8 +21,46 @@ EOF
     test_expect_equal_file EXPECTED OUTPUT
 }
 
-test_AND from
-test_AND subject
-test_AND to
+test_regex_AND() {
+    test_begin_subtest "regex field '$1:' implicitly joined by AND"
+    $2
+    notmuch count $1:alpha@beta > OUTPUT
+    notmuch count $1:/alpha/ $1:/beta/ >> OUTPUT
+    notmuch count $1:alpha@beta OR $1:beta@gamma >> OUTPUT
+    notmuch count $1:alpha@beta $1:beta@gamma >> OUTPUT
+    cat <<EOF > EXPECTED
+1
+1
+2
+0
+EOF
+    test_expect_equal_file EXPECTED OUTPUT
+}
+
+test_prob_AND from
+test_prob_AND subject
+test_prob_AND to
+
+
+add_message  "[id]=alpha@beta"
+add_message  "[id]=beta@gamma"
+
+test_regex_AND mid
+
+test_begin_subtest "'id:' implicitly joined by OR"
+notmuch count id:alpha@beta > OUTPUT
+notmuch count id:alpha@beta OR id:beta@gamma >> OUTPUT
+notmuch count id:alpha@beta id:beta@gamma >> OUTPUT
+cat <<EOF > EXPECTED
+1
+2
+2
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+notmuch tag +alpha@beta id:alpha@beta
+notmuch tag +beta@gamma id:beta@gamma
+
+test_regex_AND tag
 
 test_done
-- 
2.23.0.rc1

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

Thread: