New file. Tests for message saving and disposing commands: delete, mbox, [sS]ave, [wW]rite
Showing
1 changed file
with
104 additions
and
0 deletions
mail/testsuite/mail/write.exp
0 → 100644
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 | mail_start "--file=%mbox1" | ||
20 | |||
21 | # Delete first and last message and quit | ||
22 | mail_command "delete 1 4" | ||
23 | mail_test -noprompt "quit" \ | ||
24 | "Held 2 messages in $MAIL_SPOOL_DIR/mbox1" | ||
25 | |||
26 | # Start again using the same mailbox | ||
27 | mail_start -reuse-spool "--file=%mbox1" | ||
28 | mail_test "h" \ | ||
29 | ">U 1 Bar Fri Dec 28 23:28 16/579 Re: Jabberwocky"\ | ||
30 | " U 2 Sergey Poznyakoff Sat Jul 13 00:43 44/1645 Simple MIME" | ||
31 | |||
32 | # Send first message to mbox... | ||
33 | mail_command "mbox 1" | ||
34 | mail_test "h" \ | ||
35 | ">M 1 Bar Fri Dec 28 23:28 16/579 Re: Jabberwocky"\ | ||
36 | " U 2 Sergey Poznyakoff Sat Jul 13 00:43 44/1645 Simple MIME" | ||
37 | |||
38 | # ... and quit | ||
39 | mail_test -noprompt "quit" \ | ||
40 | "Saved 1 messages in $MAIL_SPOOL_DIR/mbox" \ | ||
41 | "Held 1 messages in $MAIL_SPOOL_DIR/mbox1" | ||
42 | |||
43 | # Now check the mbox contents | ||
44 | mail_start -reuse-spool "--file=%mbox" | ||
45 | mail_test "headers" \ | ||
46 | ">N 1 Sergey Poznyakoff Sun Jul 16 12:11 12/429 MBOX"\ | ||
47 | " U 2 Bar Fri Dec 28 23:28 16/579 Re: Jabberwocky" | ||
48 | |||
49 | # Save messages to the third mailbox | ||
50 | mail_command "set folder=\"$MAIL_FOLDER_DIR\"" | ||
51 | mail_test "save 1 2 +three" \ | ||
52 | "\"$MAIL_FOLDER_DIR/three\" 28/1008 " | ||
53 | |||
54 | mail_test "headers" \ | ||
55 | ">* 1 Sergey Poznyakoff Sun Jul 16 12:11 12/429 MBOX"\ | ||
56 | " * 2 Bar Fri Dec 28 23:28 16/579 Re: Jabberwocky" | ||
57 | |||
58 | mail_test -noprompt "quit" \ | ||
59 | "Held 0 messages in $MAIL_SPOOL_DIR/mbox" | ||
60 | |||
61 | # Examine its contents | ||
62 | mail_start -reuse-spool "--file=$MAIL_FOLDER_DIR/three" | ||
63 | mail_test "headers" \ | ||
64 | ">N 1 Sergey Poznyakoff Sun Jul 16 12:11 12/429 MBOX"\ | ||
65 | " U 2 Bar Fri Dec 28 23:28 16/579 Re: Jabberwocky" | ||
66 | |||
67 | # Test uppercase commands (Save and Copy) | ||
68 | mail_command "set outfolder=\"$MAIL_FOLDER_DIR\"" | ||
69 | mail_test "Save" \ | ||
70 | "\"$MAIL_FOLDER_DIR/gray\" 12/429 " | ||
71 | |||
72 | mail_test "file \"$MAIL_FOLDER_DIR/gray\"" \ | ||
73 | "Held 1 messages in $MAIL_FOLDER_DIR/three" | ||
74 | |||
75 | mail_test "headers" \ | ||
76 | ">N 1 Sergey Poznyakoff Sun Jul 16 12:11 12/429 MBOX" | ||
77 | mail_exit | ||
78 | |||
79 | # Test write | ||
80 | mail_start -reuse-spool "--file=%teaparty.mbox" | ||
81 | mail_command "set outfolder=\"$MAIL_FOLDER_DIR\"" | ||
82 | mail_test "write" \ | ||
83 | "\"$MAIL_FOLDER_DIR/1\" 1/15 " | ||
84 | |||
85 | mail_test "write 2 3 tmp" \ | ||
86 | "\"$MAIL_FOLDER_DIR/tmp\" 2/37 " | ||
87 | |||
88 | mail_test "Write 1 2 3" \ | ||
89 | "\"$MAIL_FOLDER_DIR/hare\" 3/52 " | ||
90 | mail_exit | ||
91 | |||
92 | # Now examine the created files | ||
93 | |||
94 | mail_test_file "$MAIL_FOLDER_DIR/1" "Have some wine" | ||
95 | mail_test_file "$MAIL_FOLDER_DIR/tmp" \ | ||
96 | "I don't see any wine" \ | ||
97 | "There isn't any" | ||
98 | mail_test_file "$MAIL_FOLDER_DIR/hare" \ | ||
99 | "Have some wine" \ | ||
100 | "I don't see any wine" \ | ||
101 | "There isn't any" | ||
102 | |||
103 | |||
104 |
-
Please register or sign in to post a comment