write.exp
3.24 KB
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
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, Free Software Foundation
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
mail_start "--file=%mbox1"
# Delete first and last message and quit
mail_command "delete 1 4"
mail_test -noprompt "quit" \
"Held 2 messages in $MU_SPOOL_DIR/mbox1"
# Start again using the same mailbox
mail_start -reuse-spool "--file=%mbox1"
mail_test "h" \
">U 1 Bar Fri Dec 28 23:28 16/579 Re: Jabberwocky"\
" U 2 Sergey Poznyakoff Sat Jul 13 00:43 44/1645 Simple MIME"
# Send first message to mbox...
mail_command "mbox 1"
mail_test "h" \
">M 1 Bar Fri Dec 28 23:28 16/579 Re: Jabberwocky"\
" U 2 Sergey Poznyakoff Sat Jul 13 00:43 44/1645 Simple MIME"
# ... and quit
mail_test -noprompt "quit" \
"Saved 1 message in $MU_SPOOL_DIR/mbox" \
"Held 1 message in $MU_SPOOL_DIR/mbox1"
# Now check the mbox contents
mail_start -reuse-spool "--file=%mbox"
mail_test "headers" \
">N 1 Sergey Poznyakoff Sun Jul 16 12:11 12/425 MBOX"\
" U 2 Bar Fri Dec 28 23:28 16/579 Re: Jabberwocky"
# Save messages to the third mailbox
mail_command "set folder=\"$MU_FOLDER_DIR\""
mail_test "save 1 2 +three" \
"\"$MU_FOLDER_DIR/three\" 28/1004"
mail_test "headers" \
">* 1 Sergey Poznyakoff Sun Jul 16 12:11 12/425 MBOX"\
" * 2 Bar Fri Dec 28 23:28 16/579 Re: Jabberwocky"
mail_test -noprompt "quit" \
"Held 0 messages in $MU_SPOOL_DIR/mbox"
# Examine its contents
mail_start -reuse-spool "--file=$MU_FOLDER_DIR/three"
mail_test "headers" \
">N 1 Sergey Poznyakoff Sun Jul 16 12:11 12/425 MBOX"\
" U 2 Bar Fri Dec 28 23:28 16/579 Re: Jabberwocky"
# Test uppercase commands (Save and Copy)
mail_command "set outfolder=\"$MU_FOLDER_DIR\""
mail_test "Save" \
"\"$MU_FOLDER_DIR/gray\" 12/425"
mail_test "file \"$MU_FOLDER_DIR/gray\"" \
"Held 1 message in $MU_FOLDER_DIR/three"
mail_test "headers" \
">N 1 Sergey Poznyakoff Sun Jul 16 12:11 12/425 MBOX"
mail_exit
# Test write
mail_start -reuse-spool "--file=%teaparty.mbox"
mail_command "set outfolder=\"$MU_FOLDER_DIR\""
mail_test "write" \
"\"$MU_FOLDER_DIR/1\" 1/15"
mail_test "write 2 3 tmp" \
"\"$MU_FOLDER_DIR/tmp\" 2/37"
mail_test "Write 1 2 3" \
"\"$MU_FOLDER_DIR/hare\" 3/52"
mail_exit
# Now examine the created files
mu_test_file "$MU_FOLDER_DIR/1" "Have some wine"
mu_test_file "$MU_FOLDER_DIR/tmp" \
"I don't see any wine" \
"There isn't any"
mu_test_file "$MU_FOLDER_DIR/hare" \
"Have some wine" \
"I don't see any wine" \
"There isn't any"
mail_stop
# End of write.exp