Commit ee466dc6 ee466dc663be6bcb699f743af2466c3920153766 by Sergey Poznyakoff

New file. Provides tests for SEARCH command.

1 parent 0ce5bbfd
1 # -*- tcl -*-
2 # This file is part of Mailutils testsuite.
3 # Copyright (C) 2002, Free Software Foundation
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 imap4d_start
20 imap4d_auth "user!passwd" "guessme"
21
22 set UIDVALIDITY [clock seconds]
23
24 imap4d_test "SELECT INBOX"\
25 "95 EXISTS"\
26 "95 RECENT"\
27 "OK \[UIDVALIDITY $UIDVALIDITY\] UID valididy status"\
28 "OK \[UIDNEXT 96\] Predicted next uid"\
29 "OK \[UNSEEN 1\] first unseen messsage "\
30 "FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft)"\
31 "OK \[PERMANENTFLAGS (\\Answered \\Deleted \\Seen)\] Permanent flags"\
32 "OK \[READ-WRITE\] SELECT Completed"
33
34 imap4d_test "SEARCH 1:*" \
35 "SEARCH 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" \
36 "OK"
37
38 imap4d_test "SEARCH ALL" \
39 "SEARCH 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" \
40 "OK"
41
42 # All messages are still new
43 imap4d_test "SEARCH NEW" \
44 "SEARCH 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" \
45 "OK"
46
47 imap4d_test "SEARCH FROM alice" \
48 "SEARCH 2 4 6 8 10 12 14 20 25 27 29 33 36 38 40 43 45 47 51 53 55 57 59 63 66 68 70 72 74 76 78 80 82 85 87 90 93 95" \
49 "OK"
50
51 imap4d_test "SEARCH FROM hare" \
52 "SEARCH 1 3 5 7 9 11 13 16 22 24 35 42 58 62 71" \
53 "OK"
54
55 imap4d_test "SEARCH LARGER 512" \
56 "SEARCH 41 46" \
57 "OK"
58
59 imap4d_test "SEARCH SMALLER 300" \
60 "SEARCH 12 20 35" \
61 "OK"
62
63 imap4d_test "SEARCH SUBJECT \"watch\"" \
64 "SEARCH 19 20 21 22 23 24 25 26 27 28 29"\
65 "OK"
66
67 imap4d_test "SEARCH HEADER Message-Id \"<200207292200.3303@wonder.land>\"" \
68 "SEARCH 3" \
69 "OK"
70
71 imap4d_test "SEARCH CC dormouse" \
72 "SEARCH 60" \
73 "OK"
74
75 imap4d_test "SEARCH TO hare"\
76 "SEARCH 2 4 6 8 10 12 14 21 23 42 59 72" \
77 "OK"
78
79 imap4d_test "SEARCH SENTBEFORE \"29-Jul-2002 22:00:02 +0100\"" \
80 "SEARCH 1"\
81 "OK"
82
83 imap4d_test "SEARCH SENTSINCE \"29-Jul-2002 22:01:32 +0100\""\
84 "SEARCH 92 93 94 95"\
85 "OK"
86
87 imap4d_test "SEARCH SENTSINCE \"29-Jul-2002 23:01:32 +0200\""\
88 "SEARCH 92 93 94 95"\
89 "OK"
90
91 imap4d_test "SEARCH BEFORE \"29-Jul-2002 22:00:09 +0000\""\
92 "SEARCH 1"\
93 "OK"
94
95 imap4d_test "SEARCH SINCE \"29-Jul-2002 22:01:36 +0000\""\
96 "SEARCH 89 90 91 92 93 94 95"\
97 "OK"
98
99 imap4d_test "STORE 3,5,89 +FLAGS (\\Answered)"\
100 "3 FETCH FLAGS (\\Answered \\Recent)"\
101 "5 FETCH FLAGS (\\Answered \\Recent)"\
102 "89 FETCH FLAGS (\\Answered \\Recent)"\
103 "OK"
104
105 imap4d_test "SEARCH ANSWERED"\
106 "SEARCH 3 5 89"\
107 "OK"
108
109 imap4d_test "SEARCH TEXT wine"\
110 "SEARCH 1 2 3"\
111 "OK"
112
113 imap4d_test "SEARCH TEXT wine FROM alice"\
114 "SEARCH 2"\
115 "OK"
116
117 imap4d_test "SEARCH OR FROM alice ANSWERED"\
118 "SEARCH 2 3 4 5 6 8 10 12 14 20 25 27 29 33 36 38 40 43 45 47 51 53 55 57 59 63 66 68 70 72 74 76 78 80 82 85 87 89 90 93 95"\
119 "OK"
120
121 imap4d_test "SEARCH (OR FROM alice ANSWERED) SENTSINCE \"29-Jul-2002 22:00:33 +0100\""\
122 "SEARCH 33 36 38 40 43 45 47 51 53 55 57 59 63 66 68 70 72 74 76 78 80 82 85 87 89 90 93 95" \
123 "OK"
124
125 imap4d_test "SEARCH (OR FROM alice ANSWERED) SENTSINCE \"29-Jul-2002 22:00:33 +0100\" SENTBEFORE \"29-Jul-2002 22:00:56 +0100\""\
126 "SEARCH 33 36 38 40 43 45 47 51 53 55"\
127 "OK"
128
129 imap4d_test "SEARCH OR FROM alice ANSWERED SENTSINCE \"29-Jul-2002 22:00:33 +0100\" SENTBEFORE \"29-Jul-2002 22:00:56 +0100\""\
130 "SEARCH 33 36 38 40 43 45 47 51 53 55"\
131 "OK"
132
133 imap4d_test "SEARCH OR FROM alice (ANSWERED SENTSINCE \"29-Jul-2002 22:00:33 +0100\" SENTBEFORE \"29-Jul-2002 22:00:56 +0100\")"\
134 "SEARCH 2 4 6 8 10 12 14 20 25 27 29 33 36 38 40 43 45 47 51 53 55 57 59 63 66 68 70 72 74 76 78 80 82 85 87 90 93 95"\
135 "OK"