unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: "Rollins, Jameson" <jrollins@caltech.edu>,
	David Bremner <david@tethera.net>,
	"Jorge P. de Morais Neto" <jorge+list@disroot.org>,
	"notmuch@notmuchmail.org" <notmuch@notmuchmail.org>
Subject: [PATCH 3/3] WIP/test: extend field grouping tests
Date: Wed, 21 Aug 2019 08:41:26 -0300	[thread overview]
Message-ID: <20190821114126.23540-4-david@tethera.net> (raw)
In-Reply-To: <20190821114126.23540-1-david@tethera.net>

---
 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

      parent reply	other threads:[~2019-08-21 12:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-11 17:20 Apparently, terms with a common prefix are *not* connected by implicit "OR" Jorge P. de Morais Neto
2019-08-11 23:08 ` David Bremner
2019-08-15 14:58   ` Jorge P. de Morais Neto
2019-08-21  1:39     ` David Bremner
2019-08-21  5:48       ` Rollins, Jameson
2019-08-21 11:41         ` WIP: fix implicit operators David Bremner
2019-08-21 11:41           ` [PATCH 1/3] test: add known broken tests for from: and subject: David Bremner
2019-08-25  9:33             ` Tomi Ollila
2019-08-21 11:41           ` [PATCH 2/3] lib: introduce N_F_GROUP and use it to fix implicit AND for from: David Bremner
2019-08-21 11:41           ` David Bremner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190821114126.23540-4-david@tethera.net \
    --to=david@tethera.net \
    --cc=jorge+list@disroot.org \
    --cc=jrollins@caltech.edu \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).