unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob e1c4acc1e9d1d8ad0358ddde14c5c24add87df0b 1663 bytes (raw)
name: test/T081-sexpr-search.sh 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
#!/usr/bin/env bash
test_description='"notmuch search" in several variations'
. $(dirname "$0")/test-lib.sh || exit 1

add_email_corpus

for query in '()' '(not)' '(and)' '(or ())' '(or (not))' '(or (and))' \
	     '(or (and) (or) (not (and)))'; do
    test_begin_subtest "all messages: $query"
    notmuch search '*' > EXPECTED
    notmuch search --query-syntax=sexp "$query" > OUTPUT
    test_expect_equal_file EXPECTED OUTPUT
done

for query in '(or)' '(not ())' '(not (not))' '(not (and))' \
		    '(not (or (and) (or) (not (and))))'; do
    test_begin_subtest "no messages: $query"
    notmuch search --query-syntax=sexp "$query" > OUTPUT
    test_expect_equal_file /dev/null OUTPUT
done

test_begin_subtest "Search by subject"
add_message [subject]=subjectsearchtest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
output=$(notmuch search --query-syntax=sexp '(subject subjectsearchtest)' | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox unread)"

test_begin_subtest "Search by subject (case insensitive)"
notmuch search tag:inbox and subject:maildir | notmuch_search_sanitize > EXPECTED
notmuch search --query-syntax=sexp '(subject Maildir)' | notmuch_search_sanitize > OUTPUT
test_expect_equal_file EXPECTED OUTPUT

test_begin_subtest "Search by subject (utf-8):"
add_message [subject]=utf8-sübjéct '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
output=$(notmuch search --query-syntax=sexp '(subject utf8 sübjéct)' | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; utf8-sübjéct (inbox unread)"

test_done

debug log:

solving 1a80a133 ...
found 1a80a133 in https://yhetil.org/notmuch/20210714000239.804384-7-david@tethera.net/
found 0b75334a in https://yhetil.org/notmuch/20210714000239.804384-6-david@tethera.net/

applying [1/2] https://yhetil.org/notmuch/20210714000239.804384-6-david@tethera.net/
diff --git a/test/T081-sexpr-search.sh b/test/T081-sexpr-search.sh
new file mode 100755
index 00000000..0b75334a


applying [2/2] https://yhetil.org/notmuch/20210714000239.804384-7-david@tethera.net/
diff --git a/test/T081-sexpr-search.sh b/test/T081-sexpr-search.sh\r
index 0b75334a..1a80a133 100755\r

Checking patch test/T081-sexpr-search.sh...
Applied patch test/T081-sexpr-search.sh cleanly.
Checking patch test/T081-sexpr-search.sh...
Applied patch test/T081-sexpr-search.sh cleanly.

index at:
100755 e1c4acc1e9d1d8ad0358ddde14c5c24add87df0b	test/T081-sexpr-search.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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