[PATCH 3/3] WIP/test: extend field grouping tests
David Bremner
david at tethera.net
Wed Aug 21 04:41:26 PDT 2019
---
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 at b"
- add_message "[$1]=b at c"
+test_prob_AND() {
+ add_message "[$1]=alpha at beta"
+ add_message "[$1]=beta at gamma"
- test_begin_subtest "$1: implicitly joined by AND"
+ test_begin_subtest "probabilistic field '$1:' implicitly joined by AND"
$2
- notmuch count $1:a at b > OUTPUT
- notmuch count $1:a $1:b >> OUTPUT
- notmuch count $1:a at b OR $1:b at c >> OUTPUT
- notmuch count $1:a at b $1:b at c >> OUTPUT
+ notmuch count $1:alpha at beta > OUTPUT
+ notmuch count $1:alpha $1:beta >> OUTPUT
+ notmuch count $1:alpha at beta OR $1:beta at gamma >> OUTPUT
+ notmuch count $1:alpha at beta $1:beta at 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 at beta > OUTPUT
+ notmuch count $1:/alpha/ $1:/beta/ >> OUTPUT
+ notmuch count $1:alpha at beta OR $1:beta at gamma >> OUTPUT
+ notmuch count $1:alpha at beta $1:beta at 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 at beta"
+add_message "[id]=beta at gamma"
+
+test_regex_AND mid
+
+test_begin_subtest "'id:' implicitly joined by OR"
+notmuch count id:alpha at beta > OUTPUT
+notmuch count id:alpha at beta OR id:beta at gamma >> OUTPUT
+notmuch count id:alpha at beta id:beta at gamma >> OUTPUT
+cat <<EOF > EXPECTED
+1
+2
+2
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+notmuch tag +alpha at beta id:alpha at beta
+notmuch tag +beta at gamma id:beta at gamma
+
+test_regex_AND tag
test_done
--
2.23.0.rc1
More information about the notmuch
mailing list