summaryrefslogtreecommitdiff
path: root/mail/testsuite/mail/write.exp
blob: c54b00d12c4ee4ac0d1f094345bfdcfc421d62ee (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
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002-2021 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 of the License, 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/>. 

mail_start "--file=%mbox1"

# Delete first and last message and quit
mail_command "delete 1 4"
mail_test -noprompt "quit" \
	  "Held 3 messages in $MU_SPOOL_DIR/mbox1"

# Start again using the same mailbox
mail_start -reuse-spool "--file=%mbox1"
# Go to the last message and do delete 4 times
mail_command "3"
mail_command "delete"
mail_command "delete"
mail_command "delete"
mail_command "delete"
# This delete should fail. Version 1.0 failed as reported by
# Dan Jacobson
# References:
#   <E1G5mnI-0004Zp-2X@jidanni1>
#   http://lists.gnu.org/archive/html/bug-mailutils/2006-07/msg00023.html
mail_test "delete" "No applicable messages"

# Start again using the same mailbox
mail_start -reuse-spool "--file=%mbox1"
mail_test "h" \
   -re {>U   1 Bar                Fri Dec 28 23:28  *[0-9]+/[0-9]+  *Re: Jabberwocky}\
   -re { U   2 Sergey Poznyakoff  Sat Jul 13 00:43  *[0-9]+/[0-9]+  *Simple MIME}\
   -re { U   3 Sergey Poznyakoff  Sat Jul 13 00:43  *[0-9]+/[0-9]+  *Empty MIME Parts}

# Send first message to mbox...
mail_command "mbox 1"
mail_test "h" \
    -re {>M   1 Bar                Fri Dec 28 23:28  *[0-9]+/[0-9]+  *Re: Jabberwocky}\
    -re { U   2 Sergey Poznyakoff  Sat Jul 13 00:43  *[0-9]+/[0-9]+  *Simple MIME}\
    -re { U   3 Sergey Poznyakoff  Sat Jul 13 00:43  *[0-9]+/[0-9]+  *Empty MIME Parts}

# ... and quit
mail_test -noprompt "quit" \
	"Saved 1 message in $MU_SPOOL_DIR/mbox" \
	"Held 2 messages in $MU_SPOOL_DIR/mbox1"

# Now check the mbox contents
mail_start -reuse-spool "--file=%mbox"
mail_test "headers" \
    -re {>N   1 Sergey Poznyakoff  Tue Jul 16 12:11  *[0-9]+/[0-9]+  *MBOX}\
    -re	{ U   2 Bar                Fri Dec 28 23:28  *[0-9]+/[0-9]+  *Re: Jabberwocky}

# Save messages to the third mailbox
mail_command "set folder=\"$MU_FOLDER_DIR\""
mail_test "save 1 2 +three" \
	-re "\"$MU_FOLDER_DIR/three\"  *\[0-9\]+/\[0-9\]+"

mail_test "headers" \
    -re {>*   1 Sergey Poznyakoff  Tue Jul 16 12:11  *[0-9]+/[0-9]+  *MBOX}\
    -re { *   2 Bar                Fri Dec 28 23:28  *[0-9]+/[0-9]+  *Re: Jabberwocky}

mail_test -noprompt "quit" \
	  "Held 2 messages in $MU_SPOOL_DIR/mbox"

# Examine its contents
mail_start -reuse-spool "--file=$MU_FOLDER_DIR/three"
mail_test "headers" \
    -re {>N   1 Sergey Poznyakoff  Tue Jul 16 12:11  *[0-9]+/[0-9]+  *MBOX}\
    -re { U   2 Bar                Fri Dec 28 23:28  *[0-9]+/[0-9]+  *Re: Jabberwocky}

# Test uppercase commands (Save and Copy)
mail_command "set outfolder=\"$MU_FOLDER_DIR\""
mail_test "Save" \
	-re "\"$MU_FOLDER_DIR/gray\"  *\[0-9\]+/\[0-9\]+"

mail_test "file \"$MU_FOLDER_DIR/gray\"" \
	"Held 2 messages in $MU_FOLDER_DIR/three"

mail_test "headers" \
    -re {>N   1 Sergey Poznyakoff  Tue Jul 16 12:11  *[0-9]+/[0-9]+  *MBOX}
mail_exit

# Test write
cd "$MU_FOLDER_DIR"
mail_start -reuse-spool "--file=%teaparty.mbox"
mail_test "write" \
    -re "\"[pwd]/1\"  *\[0-9\]+/\[0-9\]+"

mail_test "write 2 3 tmp" \
    -re "\"[pwd]/tmp\"  *\[0-9\]+/\[0-9\]+"

mail_test "Write 1 2 3" \
    -re "\"[pwd]/hare\"  *\[0-9\]+/\[0-9\]+"
mail_exit

# Now examine the created files

mu_test_file "1" "Have some wine"
mu_test_file "tmp" \
	"I don't see any wine" \
	"There isn't any"
mu_test_file "hare" \
	"Have some wine" \
	"I don't see any wine" \
	"There isn't any"

mail_stop
# End of write.exp

Return to:

Send suggestions and report system problems to the System administrator.