unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 6f0baff99e0414b5b92e865fa916c02d14443118 2058 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
38
39
40
41
42
43
44
45
46
47
48
49
 
#!/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_begin_subtest "Unbalanced parens"
# A code 1 indicates the error was handled (a crash will return e.g. 139).
test_expect_code 1 "notmuch search --query-syntax=sexp '('"

test_begin_subtest "unknown_prefix"
notmuch search --query-syntax=sexp '(foo)' >OUTPUT 2>&1
cat <<EOF > EXPECTED
notmuch search: Syntax error in query
unimplemented prefix foo
EOF
test_expect_equal_file EXPECTED OUTPUT

test_done

debug log:

solving 872f2603 ...
found 872f2603 in https://yhetil.org/notmuch/20210718024021.3850340-8-david@tethera.net/
found 41a82886 in https://yhetil.org/notmuch/20210718024021.3850340-7-david@tethera.net/

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


applying [2/2] https://yhetil.org/notmuch/20210718024021.3850340-8-david@tethera.net/
diff --git a/test/T081-sexpr-search.sh b/test/T081-sexpr-search.sh\r
index 41a82886..872f2603 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 6f0baff99e0414b5b92e865fa916c02d14443118	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).