aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2026-03-08 09:15:15 +0900
committerDavid Bremner <david@tethera.net>2026-03-14 07:35:00 +0900
commit8fa36073970cb8dce410b6f6fec2f2804e2c65cc (patch)
tree39aeb1d03a6c463c533ecc180edfba6caf314197 /test
parent51307ef90157601ca9a1865a24503e1428bcefb3 (diff)
WIP: enable new extended wildcard support in Xapian 2.0feature/wildcard
As can be seen from the included tests, this currently only works for fields without other field processors (in particular regex supporting fields seem to break it).
Diffstat (limited to 'test')
-rwxr-xr-xtest/T870-extended-wildcard.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/T870-extended-wildcard.sh b/test/T870-extended-wildcard.sh
new file mode 100755
index 00000000..16621ecf
--- /dev/null
+++ b/test/T870-extended-wildcard.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+test_description='extended wildcard support in Xapian query parser'
+. $(dirname "$0")/test-lib.sh || exit 1
+
+if [ "${NOTMUCH_HAVE_XAPIAN_WILDCARD_GLOB-0}" != "1" ]; then
+ printf "Skipping due to missing extended wildcard support\n"
+ test_done
+fi
+
+add_email_corpus
+
+count=0
+for field in "any" 'body' 'from' 'subject' 'to' ; do
+ for glob in 'm?tch' '?a?ch' 'm?tc?' '*atch' 'mat*' '*at*'; do
+ test_begin_subtest "field $field, glob $glob"
+ case $field in
+ from|subject)
+ test_subtest_known_broken
+ ;;
+ esac
+ count=$((count + 1))
+ cookie="match$count"
+ reversecookie="${count}match"
+ queryglob="$glob$count"
+ if [ $field == 'any' ]; then
+ msgfield='body'
+ queryprefix=''
+ else
+ msgfield=$field
+ queryprefix="$field:"
+ fi
+ reversequeryglob="$count$glob"
+ add_message "[$msgfield]=$cookie"
+ add_message "[$msgfield]=$reversecookie"
+ output=$(notmuch count "$queryprefix$queryglob")
+ output="$output $(notmuch count "$queryprefix$reversequeryglob")"
+ test_expect_equal "$output" "1 1"
+ done
+done
+test_done