summaryrefslogtreecommitdiff
path: root/imap4d/tests/search.at
blob: acfe171faa66f8f8b98b20649bd9dfb7bb6f9224 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2011-2012, 2014-2017 Free Software Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.

dnl SEARCH_CHECK([NAME],[KW],[ARG],[OUTPUT])
m4_define([SEARCH_CHECK],[
AT_SETUP([$1])
AT_KEYWORDS([search $2])
IMAP4D_CHECK([
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/search.mbox,INBOX)
],
[1 SELECT INBOX
2 SEARCH $3
X LOGOUT
],
[* PREAUTH IMAP4rev1 Test mode
* SEARCH $4
2 OK SEARCH Completed
* BYE Session terminating.
X OK LOGOUT Completed
],
[],
[remove_select_untagged])

AT_CLEANUP
])

dnl ----------------------------------------------------------------------
# <message set>  Messages with message sequence numbers
#                corresponding to the specified message sequence
#                number set
SEARCH_CHECK([search sequence number],[search00],
[1:*],[1 2 3 4 5 6 7 8])

# ALL            All messages in the mailbox; the default initial
#                key for ANDing.
SEARCH_CHECK([search all],[search01],
[ALL],[1 2 3 4 5 6 7 8])

# NEW            Messages that have the \Recent flag set but not the
#                \Seen flag.  This is functionally equivalent to
#                "(RECENT UNSEEN)".
SEARCH_CHECK([search new],[search02],
[NEW],[4 5 6 7 8])

# FROM <string>  Messages that contain the specified string in the
#                envelope structure's FROM field.
SEARCH_CHECK([search from personal],[search03],
[FROM corrector],[2 4 8])

SEARCH_CHECK([search from email],[search04],
[FROM lexi@example.net],[1 3 5 6 7])

# LARGER <n>     Messages with an [RFC-822] size larger than the
#                specified number of octets.
SEARCH_CHECK([search larger],[search05],
[LARGER 512],[3 4])

# SMALLER <n>    Messages with an [RFC-822] size smaller than the
#                specified number of octets.
SEARCH_CHECK([search smaller],[search06],
[SMALLER 400],[7 8])

# SUBJECT <string>   Messages that contain the specified string in the
#                    envelope structure's SUBJECT field.
SEARCH_CHECK([search subject],[search07],
[SUBJECT "Alliance"],[6])

# HEADER <field-name> <string>
#                    Messages that have a header with the specified
#                    field-name (as defined in [RFC-822]) and that
#                    contains the specified string in the [RFC-822]
#                    field-body.
SEARCH_CHECK([search header],[search08],
[HEADER Message-Id "<200207291200.3303@example.org>"],[3])

# CC <string>    Messages that contain the specified string in the
#                 envelope structure's CC field.
SEARCH_CHECK([search cc],[search09],
[CC Corrector],[6])

# TO <string>    Messages that contain the specified string in the
#                envelope structure's TO field.
SEARCH_CHECK([search to],[search10],
[TO editor+recheck],[7])

# SENTBEFORE <date>
#                Messages whose [RFC-822] Date: header is earlier
#                than the specified date.
SEARCH_CHECK([search sentbefore],[search11],
[SENTBEFORE "30-Jul-2002"],[1 2])

# SENTSINCE <date>
#                Messages whose [RFC-822] Date: header is within or
#                later than the specified date.
SEARCH_CHECK([search sentsince],[search12],
[SENTSINCE "31-Jul-2002"],[5 6 7 8])

# BEFORE <date>  Messages whose internal date is earlier than the
#                specified date.
SEARCH_CHECK([search beforedate],[search13],
[BEFORE "30-Jul-2002"],[1])

# SINCE <date>   Messages whose internal date is within or later
#                than the specified date.
SEARCH_CHECK([search since],[search14],
[SINCE "30-Jul-2002"],[2 3 4 5 6 7 8])

# ANSWERED       Messages with the \Answered flag set.
SEARCH_CHECK([search answered],[search15],
[ANSWERED],[2 3])

# TEXT <string>  Messages that contain the specified string in the
#                header or body of the message.
SEARCH_CHECK([search text],[search16],
[TEXT person],[2 5 8])

# When multiple keys are specified, the result is the intersection
# (AND function) of all the messages that match those keys.
SEARCH_CHECK([search multiple keys (implicit AND) 1],[search17],
[TEXT person FROM corrector],[2 8])

SEARCH_CHECK([search multiple keys (implicit AND) 2],[search18],
[SENTSINCE "30-Jul-2002" SENTBEFORE "31-Jul-2002"],[3 4])

# OR <search-key1> <search-key2>
#                Messages that match either search key.
SEARCH_CHECK([search or],[search19],
[OR FROM corrector ANSWERED],[2 3 4 8])

# Test precedence 
SEARCH_CHECK([precedence 1],[search20],
[(OR FROM corrector ANSWERED) SENTSINCE "30-Jul-2002"],[3 4 8])

SEARCH_CHECK([precedence 2],[search21],
[OR FROM corrector ANSWERED SENTSINCE "30-Jul-2002"],[3 4 8])

SEARCH_CHECK([precedence 3],[search22],
[OR FROM corrector (ANSWERED SENTSINCE "30-Jul-2002")],[2 3 4 8])

dnl ----------------------------------------------------------------------

Return to:

Send suggestions and report system problems to the System administrator.