blob 09226208b289e4fc02b05cb0085146c591fe80a6 1586 bytes (raw)
name: test/T600-named-queries.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
50
51
52
53
| | #!/usr/bin/env bash
test_description='named queries'
. ./test-lib.sh || exit 1
QUERYSTR="date:2009-11-18..2009-11-18 and tag:unread"
test_expect_code 1 "error adding named query before initializing DB" \
"notmuch config set query.test \"$QUERYSTR\""
add_email_corpus
test_expect_success "adding named query" \
"notmuch config set query.test \"$QUERYSTR\""
QUERYSTR2="query:test and subject:Maildir"
test_expect_success "adding nested named query" \
"notmuch config set query.test2 \"$QUERYSTR2\""
test_begin_subtest "retrieve named query"
output=$(notmuch config get query.test)
test_expect_equal "$QUERYSTR" "$output"
test_begin_subtest "List all queries"
notmuch config list | grep ^query | notmuch_config_sanitize > OUTPUT
cat <<EOF > EXPECTED
query.test=date:2009-11-18..2009-11-18 and tag:unread
query.test2=query:test and subject:Maildir
EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "dump named queries"
notmuch dump | grep '^#@' > OUTPUT
cat<<EOF > QUERIES.BEFORE
#@ query.test date%3a2009-11-18..2009-11-18%20and%20tag%3aunread
#@ query.test2 query%3atest%20and%20subject%3aMaildir
EOF
test_expect_equal_file QUERIES.BEFORE OUTPUT
test_begin_subtest "delete named queries"
notmuch dump > BEFORE
notmuch config set query.test
notmuch dump | grep '^#@' > OUTPUT
cat<<EOF > EXPECTED
#@ query.test2 query%3atest%20and%20subject%3aMaildir
EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "restore named queries"
notmuch restore < BEFORE
notmuch dump | grep '^#@' > OUTPUT
test_expect_equal_file QUERIES.BEFORE OUTPUT
test_done
|
debug log:
solving 0922620 ...
found 0922620 in https://yhetil.org/notmuch.git/
(*) 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).