Commit 2662827c 2662827ca1abe42442d14cc3cbf08d076b3ee1ab by Sergey Poznyakoff

Add MH testsuite.

* configure.ac (mh/tests): New testdir
* mh/Makefile.am (SUBDIRS): Add tests

* tests/Makefile.am: New file.
* mh/tests/Makefile.am: New file.
* mh/tests/atlocal.in: New file.
* mh/tests/folder.at: New file.
* mh/tests/inc.at: New file.
* mh/tests/mark.at: New file.
* mh/tests/mhparam.at: New file.
* mh/tests/mhpath.at: New file.
* mh/tests/refile.at: New file.
* mh/tests/rmf.at: New file.
* mh/tests/rmm.at: New file.
* mh/tests/scan.at: New file.
* mh/tests/testsuite.at: New file.
* mh/tests/.gitignore: New file.

* testsuite/testsuite.inc (MUT_MBCOPY): Work correctly if
DST is a directory name (for MH and maildir formats).

* mh/folder.c (action_list): Treat empty value as
equal to no value.
* mh/install-mh.c (main): Honor MH environment variable.
* mh/mh_ctx.c (mh_context_read, mh_context_write): Use MU streams
instead of stdio FILE.
(mh_context_iterate): Add error checking.
Do not coredump on NULL header.
* mh/mh_global.c (_mh_init_global_sequences): Destroy sequences.
* mh/TODO: Update.

* libmailutils/stream/message_stream.c (copy_trimmed_value): New
static function.
(scan_stream): Strip final newline from the saved envelope values.

* mu/Makefile.am (BUILD_SOURCES, EXTRA_DIST): Add
mu-setup.c and mu-setup.h.
1 parent 50bf64db
...@@ -1217,6 +1217,7 @@ AC_CONFIG_TESTDIR(maidag/tests) ...@@ -1217,6 +1217,7 @@ AC_CONFIG_TESTDIR(maidag/tests)
1217 AC_CONFIG_TESTDIR(messages/tests) 1217 AC_CONFIG_TESTDIR(messages/tests)
1218 AC_CONFIG_TESTDIR(readmsg/tests) 1218 AC_CONFIG_TESTDIR(readmsg/tests)
1219 AC_CONFIG_TESTDIR(sieve/tests) 1219 AC_CONFIG_TESTDIR(sieve/tests)
1220 AC_CONFIG_TESTDIR(mh/tests)
1220 1221
1221 AC_CONFIG_FILES([libmailutils/tests/Makefile 1222 AC_CONFIG_FILES([libmailutils/tests/Makefile
1222 libmailutils/tests/atlocal 1223 libmailutils/tests/atlocal
...@@ -1231,7 +1232,9 @@ AC_CONFIG_FILES([libmailutils/tests/Makefile ...@@ -1231,7 +1232,9 @@ AC_CONFIG_FILES([libmailutils/tests/Makefile
1231 readmsg/tests/Makefile 1232 readmsg/tests/Makefile
1232 readmsg/tests/atlocal 1233 readmsg/tests/atlocal
1233 sieve/tests/Makefile 1234 sieve/tests/Makefile
1234 sieve/tests/atlocal]) 1235 sieve/tests/atlocal
1236 mh/tests/Makefile
1237 mh/tests/atlocal])
1235 AM_MISSING_PROG([AUTOM4TE], [autom4te]) 1238 AM_MISSING_PROG([AUTOM4TE], [autom4te])
1236 1239
1237 dnl Make sysconfdir available to the application 1240 dnl Make sysconfdir available to the application
......
...@@ -130,6 +130,20 @@ _message_size (mu_stream_t stream, mu_off_t *psize) ...@@ -130,6 +130,20 @@ _message_size (mu_stream_t stream, mu_off_t *psize)
130 return rc; 130 return rc;
131 } 131 }
132 132
133 static char *
134 copy_trimmed_value (const char *str)
135 {
136 char *p;
137 size_t len;
138
139 str = mu_str_skip_class (str, MU_CTYPE_SPACE);
140 len = strlen (str) - 1;
141 p = malloc (len);
142 memcpy (p, str, len);
143 p[len] = 0;
144 return p;
145 }
146
133 static int 147 static int
134 scan_stream (struct _mu_message_stream *str) 148 scan_stream (struct _mu_message_stream *str)
135 { 149 {
...@@ -180,21 +194,17 @@ scan_stream (struct _mu_message_stream *str) ...@@ -180,21 +194,17 @@ scan_stream (struct _mu_message_stream *str)
180 if (!from && mu_c_strncasecmp (buffer, MU_HEADER_FROM, 194 if (!from && mu_c_strncasecmp (buffer, MU_HEADER_FROM,
181 sizeof (MU_HEADER_FROM) - 1) == 0) 195 sizeof (MU_HEADER_FROM) - 1) == 0)
182 196
183 from = mu_strdup (mu_str_skip_class (buffer + 197 from = copy_trimmed_value (buffer + sizeof (MU_HEADER_FROM));
184 sizeof (MU_HEADER_FROM),
185 MU_CTYPE_SPACE));
186 else if (!env_from 198 else if (!env_from
187 && mu_c_strncasecmp (buffer, MU_HEADER_ENV_SENDER, 199 && mu_c_strncasecmp (buffer, MU_HEADER_ENV_SENDER,
188 sizeof (MU_HEADER_ENV_SENDER) - 1) == 0) 200 sizeof (MU_HEADER_ENV_SENDER) - 1) == 0)
189 env_from = mu_strdup (mu_str_skip_class (buffer + 201 env_from = copy_trimmed_value (buffer +
190 sizeof (MU_HEADER_ENV_SENDER), 202 sizeof (MU_HEADER_ENV_SENDER));
191 MU_CTYPE_SPACE));
192 else if (!env_date 203 else if (!env_date
193 && mu_c_strncasecmp (buffer, MU_HEADER_ENV_DATE, 204 && mu_c_strncasecmp (buffer, MU_HEADER_ENV_DATE,
194 sizeof (MU_HEADER_ENV_DATE) - 1) == 0) 205 sizeof (MU_HEADER_ENV_DATE) - 1) == 0)
195 env_date = mu_strdup (mu_str_skip_class (buffer + 206 env_date = copy_trimmed_value (buffer +
196 sizeof (MU_HEADER_ENV_DATE), 207 sizeof (MU_HEADER_ENV_DATE));
197 MU_CTYPE_SPACE));
198 } 208 }
199 } 209 }
200 210
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
15 ## You should have received a copy of the GNU General Public License 15 ## You should have received a copy of the GNU General Public License
16 ## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. 16 ## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SUBDIRS = . tests
18 bindir = @MH_BIN_DIR@ 19 bindir = @MH_BIN_DIR@
19 mhlibdir = $(pkgdatadir)/mh 20 mhlibdir = $(pkgdatadir)/mh
20 bin_PROGRAMS = \ 21 bin_PROGRAMS = \
......
...@@ -24,7 +24,7 @@ State Nice Utility Comments ...@@ -24,7 +24,7 @@ State Nice Utility Comments
24 * -20 forw --inplace,--whatnowproc 24 * -20 forw --inplace,--whatnowproc
25 * -20 send --alias,--filter,--format,--forward,--mime, 25 * -20 send --alias,--filter,--format,--forward,--mime,
26 --width 26 --width
27 * -20 refile --link copies messages. 27 * -20 refile --link copies messages; rmmproc ignored.
28 * -20 rmm rmproc: 28 * -20 rmm rmproc:
29 + -15 folder(s) 29 + -15 folder(s)
30 + -15 mhn 30 + -15 mhn
...@@ -34,7 +34,7 @@ State Nice Utility Comments ...@@ -34,7 +34,7 @@ State Nice Utility Comments
34 center,split,datefield 34 center,split,datefield
35 + 5 mark 35 + 5 mark
36 + 5 pick See the README entry. 36 + 5 pick See the README entry.
37 + 10 anno 37 + 10 anno -inplace
38 + 10 burst See the README entry. 38 + 10 burst See the README entry.
39 * 10 whom --check 39 * 10 whom --check
40 + 10 mhpath 40 + 10 mhpath
......
...@@ -506,7 +506,7 @@ action_list () ...@@ -506,7 +506,7 @@ action_list ()
506 const char *stack = mh_global_context_get ("Folder-Stack", NULL); 506 const char *stack = mh_global_context_get ("Folder-Stack", NULL);
507 507
508 printf ("%s", mh_current_folder ()); 508 printf ("%s", mh_current_folder ());
509 if (stack) 509 if (stack && stack[0])
510 printf (" %s", stack); 510 printf (" %s", stack);
511 printf ("\n"); 511 printf ("\n");
512 return 0; 512 return 0;
......
...@@ -57,7 +57,7 @@ opt_handler (int key, char *arg, struct argp_state *state) ...@@ -57,7 +57,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
57 int 57 int
58 main (int argc, char **argv) 58 main (int argc, char **argv)
59 { 59 {
60 char *home, *name; 60 char *name;
61 extern int mh_auto_install; 61 extern int mh_auto_install;
62 62
63 /* Native Language Support */ 63 /* Native Language Support */
...@@ -68,10 +68,17 @@ main (int argc, char **argv) ...@@ -68,10 +68,17 @@ main (int argc, char **argv)
68 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 68 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
69 opt_handler, NULL, NULL); 69 opt_handler, NULL, NULL);
70 70
71 home = mu_get_homedir (); 71 name = getenv ("MH");
72 if (name)
73 name = mu_tilde_expansion (name, "/", NULL);
74 else
75 {
76 char *home = mu_get_homedir ();
72 if (!home) 77 if (!home)
73 abort (); /* shouldn't happen */ 78 abort (); /* shouldn't happen */
74 name = mh_safe_make_file_name (home, MH_USER_PROFILE); 79 name = mh_safe_make_file_name (home, MH_USER_PROFILE);
80 free (home);
81 }
75 mh_install (name, automode); 82 mh_install (name, automode);
76 return 0; 83 return 0;
77 } 84 }
......
...@@ -80,80 +80,81 @@ mh_context_merge (mh_context_t *dst, mh_context_t *src) ...@@ -80,80 +80,81 @@ mh_context_merge (mh_context_t *dst, mh_context_t *src)
80 int 80 int
81 mh_context_read (mh_context_t *ctx) 81 mh_context_read (mh_context_t *ctx)
82 { 82 {
83 int status; 83 int rc;
84 char *blurb, *p; 84 char *blurb, *p;
85 struct stat st; 85 mu_stream_t stream;
86 FILE *fp; 86 mu_off_t stream_size;
87 char *buf = NULL; 87 char *buf = NULL;
88 size_t size = 0; 88 size_t size = 0, n;
89 89
90 if (!ctx) 90 if (!ctx)
91 return MU_ERR_OUT_NULL; 91 return MU_ERR_OUT_NULL;
92 92
93 if (stat (ctx->name, &st)) 93 rc = mu_file_stream_create (&stream, ctx->name, MU_STREAM_READ);
94 return errno; 94 if (rc)
95 return rc;
95 96
96 blurb = malloc (st.st_size); 97 rc = mu_stream_size (stream, &stream_size);
97 if (!blurb) 98 if (rc)
98 return ENOMEM; 99 {
100 mu_stream_destroy (&stream);
101 return rc;
102 }
99 103
100 fp = fopen (ctx->name, "r"); 104 blurb = malloc (stream_size + 1);
101 if (!fp) 105 if (!blurb)
102 { 106 {
103 free (blurb); 107 mu_stream_destroy (&stream);
104 return errno; 108 return ENOMEM;
105 } 109 }
106 110
107 p = blurb; 111 p = blurb;
108 while (getline (&buf, &size, fp) > 0) 112 while (mu_stream_getline (stream, &buf, &size, &n) == 0 && n > 0)
109 { 113 {
110 char *q; 114 char *q = mu_str_skip_class (buf, MU_CTYPE_SPACE);
111
112 for (q = buf; *q && mu_isspace (*q); q++)
113 ;
114 if (!*q || *q == '#') 115 if (!*q || *q == '#')
115 continue; 116 continue;
116
117 for (q = buf; *q;) 117 for (q = buf; *q;)
118 *p++ = *q++; 118 *p++ = *q++;
119 } 119 }
120 fclose (fp); 120 mu_stream_destroy (&stream);
121 121 rc = mu_header_create (&ctx->header, blurb, p - blurb);
122 status = mu_header_create (&ctx->header, blurb, p - blurb);
123 free (blurb); 122 free (blurb);
124 123
125 return status; 124 return rc;
126 } 125 }
127 126
128 int 127 int
129 mh_context_write (mh_context_t *ctx) 128 mh_context_write (mh_context_t *ctx)
130 { 129 {
131 mu_stream_t stream; 130 int rc;
132 char buffer[512]; 131 mu_stream_t instream, outstream;
133 size_t n; 132 mu_off_t size;
134 FILE *fp;
135 133
136 if (!ctx) 134 if (!ctx)
137 return MU_ERR_OUT_NULL; 135 return MU_ERR_OUT_NULL;
138 136
139 fp = fopen (ctx->name, "w"); 137 rc = mu_file_stream_create (&outstream, ctx->name,
140 if (!fp) 138 MU_STREAM_WRITE|MU_STREAM_CREAT);
139 if (rc)
141 { 140 {
142 mu_error (_("cannot open context file %s: %s"), 141 mu_error (_("cannot open context file %s for writing: %s"),
143 ctx->name, strerror (errno)); 142 ctx->name, mu_strerror (rc));
144 return MU_ERR_FAILURE; 143 return MU_ERR_FAILURE;
145 } 144 }
146 145
147 /* FIXME: Use mu_stream+copy */ 146 mu_header_get_streamref (ctx->header, &instream);
148 mu_header_get_streamref (ctx->header, &stream); 147 rc = mu_stream_copy (outstream, instream, 0, &size);
149 while (mu_stream_read (stream, buffer, sizeof buffer - 1, &n) == 0 148 if (rc)
150 && n != 0)
151 { 149 {
152 buffer[n] = '\0'; 150 mu_error (_("error writing to context file %s: %s"),
153 fprintf (fp, "%s", buffer); 151 ctx->name, mu_strerror (rc));
152 return MU_ERR_FAILURE;
154 } 153 }
155 mu_stream_destroy (&stream); 154 else
156 fclose (fp); 155 rc = mu_stream_truncate (outstream, size);
156 mu_stream_destroy (&instream);
157 mu_stream_destroy (&outstream);
157 return 0; 158 return 0;
158 } 159 }
159 160
...@@ -194,13 +195,35 @@ mh_context_iterate (mh_context_t *ctx, mh_context_iterator fp, void *data) ...@@ -194,13 +195,35 @@ mh_context_iterate (mh_context_t *ctx, mh_context_iterator fp, void *data)
194 195
195 if (!ctx) 196 if (!ctx)
196 return EINVAL; 197 return EINVAL;
197 mu_header_get_field_count (ctx->header, &nfields); 198 if (!ctx->header)
199 return 0;
200 rc = mu_header_get_field_count (ctx->header, &nfields);
201 if (rc)
202 {
203 mu_error (_("cannot obtain field count for context %s"), ctx->name);
204 return rc;
205 }
206
198 for (i = 1; i <= nfields && rc == 0; i++) 207 for (i = 1; i <= nfields && rc == 0; i++)
199 { 208 {
200 const char *name, *value; 209 const char *name, *value;
201 210
202 mu_header_sget_field_name (ctx->header, i, &name); 211 rc = mu_header_sget_field_name (ctx->header, i, &name);
203 mu_header_sget_field_value (ctx->header, i, &value); 212 if (rc)
213 {
214 mu_error (_("cannot obtain field name for context %s:%d: %s"),
215 ctx->name,i,mu_strerror (rc));
216 break;
217 }
218
219 rc = mu_header_sget_field_value (ctx->header, i, &value);
220 if (rc)
221 {
222 mu_error (_("cannot obtain field value for context %s:%d: %s"),
223 ctx->name,i,mu_strerror (rc));
224 break;
225 }
226
204 rc = fp (name, value, data); 227 rc = fp (name, value, data);
205 } 228 }
206 229
......
...@@ -163,7 +163,7 @@ _mh_init_global_sequences () ...@@ -163,7 +163,7 @@ _mh_init_global_sequences ()
163 void 163 void
164 mh_global_sequences_drop () 164 mh_global_sequences_drop ()
165 { 165 {
166 sequences = NULL; 166 mh_context_destroy (&sequences);
167 } 167 }
168 168
169 const char * 169 const char *
......
1 atconfig
2 atlocal
3 package.m4
4 status.mf
5 testsuite
6 testsuite.dir
7 testsuite.log
1 # This file is part of GNU Mailutils.
2 # Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
3 #
4 # GNU Mailutils is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3, or (at
7 # your option) any later version.
8 #
9 # GNU Mailutils is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
16
17 EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4
18 DISTCLEANFILES = atconfig $(check_SCRIPTS)
19 MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
20
21 ## ------------ ##
22 ## package.m4. ##
23 ## ------------ ##
24
25 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
26 $(AM_V_GEN){ \
27 echo '# Signature of the current package.'; \
28 echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
29 echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
30 echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
31 echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
32 echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
33 } >$(srcdir)/package.m4
34
35 #
36
37 ## ------------ ##
38 ## Test suite. ##
39 ## ------------ ##
40
41 TESTSUITE_AT = \
42 folder.at\
43 inc.at\
44 mark.at\
45 mhparam.at\
46 mhpath.at\
47 scan.at\
48 refile.at\
49 rmf.at\
50 rmm.at\
51 testsuite.at
52
53 TESTSUITE = $(srcdir)/testsuite
54 M4=m4
55
56 AUTOTEST = $(AUTOM4TE) --language=autotest
57 $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc
58 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp
59 $(AM_V_at)mv $@.tmp $@
60
61 atconfig: $(top_builddir)/config.status
62 cd $(top_builddir) && ./config.status tests/$@
63
64 clean-local:
65 @test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
66
67 check-local: atconfig atlocal $(TESTSUITE)
68 @$(SHELL) $(TESTSUITE)
69
70 # Run the test suite on the *installed* tree.
71 #installcheck-local:
72 # $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
73
74
1 # @configure_input@ -*- shell-script -*-
2 # Configurable variable values for Mailutils test suite.
3 # Copyright (C) 2004, 2010 Free Software Foundation, Inc.
4
5 PATH=@abs_builddir@:@abs_top_builddir@/mh:$top_srcdir:$srcdir:$PATH
6
...\ No newline at end of file ...\ No newline at end of file
1 # This file is part of GNU Mailutils. -*- Autotest -*-
2 # Copyright (C) 2010 Free Software Foundation, Inc.
3 #
4 # GNU Mailutils is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3, or (at
7 # your option) any later version.
8 #
9 # GNU Mailutils is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
16
17 m4_pushdef[MH_KEYWORDS],[folder])
18
19 MH_CHECK([folder],[folder00 folder-print],[
20 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
21 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail])
22 echo 'Current-Folder: inbox' > Mail/context
23 folder
24 ],
25 [0],
26 [ inbox+ has 5 messages ( 1- 5).
27 ])
28
29 MH_CHECK([folder -all],[folder01 folder-all],[
30 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
31 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail])
32 echo 'Current-Folder: inbox' > Mail/context
33 folder -all
34 ],
35 [0],
36 [dnl
37 Folder # of messages ( range ) cur msg (other files)
38 inbox+ has 5 messages ( 1- 5).
39 teaparty has 95 messages ( 1- 95).
40
41 TOTAL= 100 messages in 2 folders
42 ])
43
44 MH_CHECK([folder -all -fast],[folder02 folder-all folder-all-fast],[
45 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
46 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail])
47 echo 'Current-Folder: inbox' > Mail/context
48 folder -all -fast
49 ],
50 [0],
51 [inbox
52 teaparty
53 ])
54
55 MH_CHECK([folder +mbox],[folder03 folder+mbox],[
56 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
57 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail])
58 echo 'Current-Folder: inbox' > Mail/context
59 folder +teaparty
60 sed -n 's/^\(Current-Folder\): *\(.*\)/\1: \2/p' Mail/context
61 ],
62 [0],
63 [dnl
64 teaparty+ has 95 messages ( 1- 95).
65 Current-Folder: teaparty
66 ])
67
68 MH_CHECK([folder +mbox msg],[folder04 folder+mbox_msg],[
69 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
70 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail])
71 echo 'Current-Folder: inbox' > Mail/context
72 folder +teaparty 35
73 sed -n 's/^\(Current-Folder\): *\(.*\)/context: \1: \2/p' Mail/context
74 sed -n 's/^\(cur\): *\(.*\)/mh_sequences: \1: \2/p' Mail/teaparty/.mh_sequences
75 ],
76 [0],
77 [dnl
78 teaparty+ has 95 messages ( 1- 95); cur= 35.
79 context: Current-Folder: teaparty
80 mh_sequences: cur: 35
81 ])
82
83 MH_CHECK([folder -pack],[folder05 folder-pack],[
84 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
85 for i in 2 3 4 5
86 do
87 mv Mail/inbox/$i Mail/inbox/${i}0
88 done
89 folder -pack || exit $?
90 find Mail/inbox
91 ],
92 [0],
93 [Mail/inbox
94 Mail/inbox/1
95 Mail/inbox/2
96 Mail/inbox/3
97 Mail/inbox/4
98 Mail/inbox/5
99 Mail/inbox/.mh_sequences
100 ])
101
102 MH_CHECK([folder --pack=N],[folder06 folder--pack=N],[
103 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
104 for i in 1 2 3 4 5
105 do
106 mv Mail/inbox/$i Mail/inbox/${i}0
107 done
108 folder --pack=1 || exit $?
109 find Mail/inbox
110 ],
111 [0],
112 [Mail/inbox
113 Mail/inbox/1
114 Mail/inbox/2
115 Mail/inbox/3
116 Mail/inbox/4
117 Mail/inbox/5
118 Mail/inbox/.mh_sequences
119 ])
120
121 MH_CHECK([folder -push/-pop],[folder07 folder-push folder-pop folder-push-pop],
122 [
123 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
124 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail])
125 folder -push +teaparty
126 folder -pop
127 folder -push +teaparty
128 folder -push
129 folder -pop
130 ],
131 [0],
132 [teaparty inbox
133 inbox
134 teaparty inbox
135 inbox teaparty
136 teaparty
137 ])
138
139 MH_CHECK([folder -create],[folder08 folder-create],[
140 folder -create +new
141 ],
142 [0],
143 [ new+ has no messages.
144 ])
145
146 m4_popdef[MH_KEYWORDS])
147 # End of folder.at
1 # This file is part of GNU Mailutils. -*- Autotest -*-
2 # Copyright (C) 2010 Free Software Foundation, Inc.
3 #
4 # GNU Mailutils is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3, or (at
7 # your option) any later version.
8 #
9 # GNU Mailutils is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
16
17 m4_pushdef[MH_KEYWORDS],[inc])
18
19 MH_CHECK([inc -notruncate],[inc00 inc-notruncate],[
20 MUT_MBCOPY([$abs_top_srcdir/testsuite/spool/mbox1])
21 inc -notruncate -file ./mbox1 | sed 's/ *$//'
22 cmp $abs_top_srcdir/testsuite/spool/mbox1 mbox1
23 ],
24 [0],
25 [ 1 12/28 Foo Bar <foobar@n Jabberwocky<<`Twas brillig, and the slithy toves
26 2 12/28 Bar <bar@dontmail Re: Jabberwocky<<It seems very pretty, but it's
27 3 07/13 Sergey Poznyakoff Simple MIME<<------- =_aaaaaaaaaa0 Content-Type:
28 4 07/13 Sergey Poznyakoff Nested MIME<<------- =_aaaaaaaaaa0 Content-Type:
29 5 07/13 Sergey Poznyakoff Empty MIME Parts<<------- =_aaaaaaaaaa0 Content-
30 ])
31
32 MH_CHECK([inc -truncate],[inc01 inc-truncate],[
33 MUT_MBCOPY([$abs_top_srcdir/testsuite/spool/mbox1])
34 inc -truncate -file ./mbox1 | sed 's/ *$//'
35 echo "Next"
36 inc -truncate -file ./mbox1 | sed 's/ *$//'
37 ],
38 [0],
39 [ 1 12/28 Foo Bar <foobar@n Jabberwocky<<`Twas brillig, and the slithy toves
40 2 12/28 Bar <bar@dontmail Re: Jabberwocky<<It seems very pretty, but it's
41 3 07/13 Sergey Poznyakoff Simple MIME<<------- =_aaaaaaaaaa0 Content-Type:
42 4 07/13 Sergey Poznyakoff Nested MIME<<------- =_aaaaaaaaaa0 Content-Type:
43 5 07/13 Sergey Poznyakoff Empty MIME Parts<<------- =_aaaaaaaaaa0 Content-
44 Next
45 ])
46
47 MH_CHECK([inc -folder],[inc02 inc-folder],[
48 MUT_MBCOPY([$abs_top_srcdir/testsuite/spool/mbox1])
49 mkdir Mail/new
50 inc +new -file ./mbox1 | sed 's/ *$//'
51 ],
52 [0],
53 [ 1 12/28 Foo Bar <foobar@n Jabberwocky<<`Twas brillig, and the slithy toves
54 2 12/28 Bar <bar@dontmail Re: Jabberwocky<<It seems very pretty, but it's
55 3 07/13 Sergey Poznyakoff Simple MIME<<------- =_aaaaaaaaaa0 Content-Type:
56 4 07/13 Sergey Poznyakoff Nested MIME<<------- =_aaaaaaaaaa0 Content-Type:
57 5 07/13 Sergey Poznyakoff Empty MIME Parts<<------- =_aaaaaaaaaa0 Content-
58 ])
59
60 m4_popdef[MH_KEYWORDS])
61 # End of inc.at
1 # This file is part of GNU Mailutils. -*- Autotest -*-
2 # Copyright (C) 2010 Free Software Foundation, Inc.
3 #
4 # GNU Mailutils is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3, or (at
7 # your option) any later version.
8 #
9 # GNU Mailutils is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
16
17 m4_pushdef[MH_KEYWORDS],[mark])
18
19 MH_CHECK([mark -add],[mark00 mark-add],[
20 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
21 echo 'Current-Folder: inbox' > Mail/context
22 mark -sequence andro -add 2
23 mark -sequence andro -add 3-5
24 sed -n '/^andro:/{s/ */ /g;s/ $//;p}' Mail/inbox/.mh_sequences
25 ],
26 [0],
27 [andro: 2 3 4 5
28 ])
29
30 MH_CHECK([mark -add -zero],[mark01 mark-add-zero],[
31 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
32 echo 'Current-Folder: inbox' > Mail/context
33 mark -sequence andro -add 2
34 sed -n '/^andro:/{s/ */ /g;s/ $//;p}' Mail/inbox/.mh_sequences
35 mark -zero -sequence andro -add 1 3
36 sed -n '/^andro:/{s/ */ /g;s/ $//;p}' Mail/inbox/.mh_sequences
37 ],
38 [0],
39 [andro: 2
40 andro: 1 3
41 ])
42
43 MH_CHECK([mark -add -nopublic],[mark02 mark-add-nopublic],[
44 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
45 echo 'Current-Folder: inbox' > Mail/context
46 mark -nopublic -sequence andro -add 1 2 3
47 dir=`pwd`
48 sed -n '/^atr-andro/{s/ */ /g;s/ $//;s/^[[^:]]*:/atr-andro:/;p}' Mail/context
49 ],
50 [0],
51 [atr-andro: 1 2 3
52 ])
53
54 MH_CHECK([mark -del],[mark03 mark-del],[
55 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
56 echo 'Current-Folder: inbox' > Mail/context
57 echo 'andro: 2 3 4 5' > Mail/inbox/.mh_sequences
58 mark -sequence andro -del 3
59 sed -n '/^andro:/{s/ */ /g;s/ $//;p}' Mail/inbox/.mh_sequences
60 ],
61 [0],
62 [andro: 2 4 5
63 ])
64
65 MH_CHECK([mark -del -nopublic],[mark04 mark-del-nopublic],[
66 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
67 echo 'Current-Folder: inbox' > Mail/context
68 inbox=`pwd`/Mail/inbox
69 cat > Mail/context <<EOT
70 atr-andro-$inbox: 2 3 4 5
71 EOT
72 mark -nopublic -sequence andro -del 3
73 sed -n '/^atr-andro/{s/ */ /g;s/ $//;s/^[[^:]]*:/atr-andro:/;p}' Mail/context
74 ],
75 [0],
76 [atr-andro: 2 4 5
77 ])
78
79 MH_CHECK([mark -list],[mark05 mark-list],[
80 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
81 echo 'Current-Folder: inbox' > Mail/context
82 inbox=`pwd`/Mail/inbox
83 cat > Mail/context <<EOT
84 atr-andro-$inbox: 2 3
85 EOT
86 cat > Mail/inbox/.mh_sequences <<EOT
87 cur: 1
88 andro: 1 5
89 gwerz: 4
90 EOT
91 mark -list
92 ],
93 [0],
94 [cur: 1
95 andro: 1 5
96 gwerz: 4
97 andro (private): 2 3
98 ])
99
100 m4_popdef[MH_KEYWORDS])
101 # End of mark.at
1 # This file is part of GNU Mailutils. -*- Autotest -*-
2 # Copyright (C) 2010 Free Software Foundation, Inc.
3 #
4 # GNU Mailutils is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3, or (at
7 # your option) any later version.
8 #
9 # GNU Mailutils is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
16
17 m4_pushdef[MH_KEYWORDS],[mhparam])
18
19 MH_CHECK([mhparam -all],[mhparam00 mhparam-all],[
20 cat >>$MH <<EOT
21 Sequence-Negation: not
22 Draft-Folder: Mail/drafts
23 Aliasfile: .mh_aliases
24 EOT
25 mhparam -all | tr '\t' ' ' | sed 's/^Path:.*/Path: Mail/;s/ */ /g'
26 ],
27 [0],
28 [Path: Mail
29 Sequence-Negation: not
30 Draft-Folder: Mail/drafts
31 Aliasfile: .mh_aliases
32 ])
33
34 MH_CHECK([mhparam comp],[mhparam01 mhparam_comp],[
35 cat >>$MH <<EOT
36 Sequence-Negation: not
37 Draft-Folder: Mail/drafts
38 Aliasfile: .mh_aliases
39 EOT
40 mhparam Sequence-Negation
41 ],
42 [0],
43 [not
44 ])
45
46 MH_CHECK([mhparam comp comp],[mhparam02 mhparam_comp_comp],[
47 cat >>$MH <<EOT
48 Sequence-Negation: not
49 Draft-Folder: Mail/drafts
50 Aliasfile: .mh_aliases
51 EOT
52 mhparam Sequence-Negation Aliasfile | tr '\t' ' '
53 ],
54 [0],
55 [Sequence-Negation: not
56 Aliasfile: .mh_aliases
57 ])
58
59 MH_CHECK([mhparam -component comp],[mhparam03 mhparam-component_comp],[
60 cat >>$MH <<EOT
61 Sequence-Negation: not
62 Draft-Folder: Mail/drafts
63 Aliasfile: .mh_aliases
64 EOT
65 mhparam -component Sequence-Negation | tr '\t' ' ' | sed 's/ */ /g'
66 ],
67 [0],
68 [Sequence-Negation: not
69 ])
70
71 m4_popdef[MH_KEYWORDS])
72 # End of mhparam.at
1 # This file is part of GNU Mailutils. -*- Autotest -*-
2 # Copyright (C) 2010 Free Software Foundation, Inc.
3 #
4 # GNU Mailutils is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3, or (at
7 # your option) any later version.
8 #
9 # GNU Mailutils is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
16
17 m4_pushdef[MH_KEYWORDS],[mhpath])
18
19 MH_CHECK([mhpath],[mhpath00],[
20 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
21 echo 'Current-Folder: inbox' > Mail/context
22 mhpath | sed 's|^'"$dir"'/||'
23 ],
24 [0],
25 [Mail/inbox
26 ])
27
28 MH_CHECK([mhpath +],[mhpath01 mhpath+],[
29 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
30 echo 'Current-Folder: inbox' > Mail/context
31 mhpath +| sed 's|^'"$dir"'/||'
32 ],
33 [0],
34 [Mail
35 ])
36
37 MH_CHECK([mhpath msgs],[mhpath02 mhparam_msgs],[
38 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
39 dir=`pwd`
40 mhpath 1-3 | sed 's|^'"$dir"'/||'
41 ],
42 [0],
43 [Mail/inbox/1
44 Mail/inbox/2
45 Mail/inbox/3
46 ])
47
48 MH_CHECK([mhpath msgs (some nonexistent)],[mhpath03 mhparam_msgs_some_nonex],[
49 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
50 dir=`pwd`
51 mhpath 4-10 | sed 's|^'"$dir"'/||'
52 ],
53 [0],
54 [Mail/inbox/4
55 Mail/inbox/5
56 ])
57
58 MH_CHECK([mhpath msgs (all nonexistent)],[mhpath04 mhparam_msgs_all_nonex],[
59 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
60 dir=`pwd`
61 mhpath 8-10 | sed 's|^'"$dir"'/||'
62 ],
63 [0],
64 [],
65 [mhpath: no messages in range 8-10
66 ])
67
68 # FIXME: This test is dubious:
69 # 1. Both MH and nmh manuals claim that:
70 #
71 # 2) Within a message list, the following designations may refer to mes-
72 # sages that do not exist: a single numeric message name[...]
73 #
74 # However, neither mhpath implementation follows this claim. Should we?
75 # 2. If a single non-existent message number is given, both MH and nmh
76 # implementations of mhpath produce the following error message:
77 #
78 # mhpath: message N out of range X-Y
79 #
80 # The diagnostics produced by my implementation differs. This should
81 # be fixed, all the more that:
82 # 3. The rest of utilities, when given a single non-existent message number,
83 # produce the following error message:
84 #
85 # folder: message N doesn't exist
86 #
87 # Note the contracted negation, in place of a full one in MU diagnostics.
88 #
89
90 MH_CHECK([mhpath nonexistent],[mhpath05 mhparam_nonexistent],[
91 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
92 dir=`pwd`
93 mhpath 10 | sed 's|^'"$dir"'/||'
94 ],
95 [0],
96 [],
97 [mhpath: message 10 does not exist
98 ])
99
100 MH_CHECK([mhpath new],[mhpath06 mhparam_new],[
101 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
102 dir=`pwd`
103 mhpath new | sed 's|^'"$dir"'/||'
104 ],
105 [0],
106 [Mail/inbox/6
107 ])
108
109 m4_popdef[MH_KEYWORDS])
110 # End of mhpath.at
1 # This file is part of GNU Mailutils. -*- Autotest -*-
2 # Copyright (C) 2010 Free Software Foundation, Inc.
3 #
4 # GNU Mailutils is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3, or (at
7 # your option) any later version.
8 #
9 # GNU Mailutils is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
16
17 m4_pushdef[MH_KEYWORDS],[refile])
18
19 MH_CHECK([refile],[refile00],[
20 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
21 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/teaparty])
22 echo 'Current-Folder: teaparty' > Mail/context
23 refile 3 4 +inbox || exit $?
24 find Mail/inbox -name '[[0-9]]' | sort
25 cmp Mail/inbox/6 Mail/teaparty/,3 >/dev/null || echo "Message 3 differs"
26 cmp Mail/inbox/7 Mail/teaparty/,4 >/dev/null || echo "Message 4 differs"
27 ],
28 [0],
29 [Mail/inbox/1
30 Mail/inbox/2
31 Mail/inbox/3
32 Mail/inbox/4
33 Mail/inbox/5
34 Mail/inbox/6
35 Mail/inbox/7
36 ])
37
38 MH_CHECK([refile -file],[refile01 refile-file],[
39 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
40 echo 'Current-Folder: inbox' > Mail/context
41 cp Mail/inbox/2 message
42 refile -file `pwd`/message +inbox || exit $?
43 find Mail/inbox -name '[[0-9]]' | sort
44 cmp Mail/inbox/2 Mail/inbox/6 >/dev/null || echo "Message differs"
45 ],
46 [0],
47 [Mail/inbox/1
48 Mail/inbox/2
49 Mail/inbox/3
50 Mail/inbox/4
51 Mail/inbox/5
52 Mail/inbox/6
53 ])
54
55 MH_CHECK([refile --copy],[refile02 refile--copy],[
56 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
57 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/teaparty])
58 echo 'Current-Folder: teaparty' > Mail/context
59 refile --copy 3 4 +inbox || exit $?
60 find Mail/inbox -name '[[0-9]]' | sort
61 cmp Mail/inbox/6 Mail/teaparty/3 >/dev/null || echo "Message 3 differs"
62 cmp Mail/inbox/7 Mail/teaparty/4 >/dev/null || echo "Message 4 differs"
63 ],
64 [0],
65 [Mail/inbox/1
66 Mail/inbox/2
67 Mail/inbox/3
68 Mail/inbox/4
69 Mail/inbox/5
70 Mail/inbox/6
71 Mail/inbox/7
72 ])
73
74 m4_popdef[MH_KEYWORDS])
75 # End of refile.at
1 # This file is part of GNU Mailutils. -*- Autotest -*-
2 # Copyright (C) 2010 Free Software Foundation, Inc.
3 #
4 # GNU Mailutils is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3, or (at
7 # your option) any later version.
8 #
9 # GNU Mailutils is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
16
17 m4_pushdef[MH_KEYWORDS],[rmm])
18
19 MH_CHECK([rmf +folder],[rmf00 rmf+folder],[
20 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
21 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail])
22 echo 'Current-Folder: inbox' > Mail/context
23 rmf +teaparty || exit $?
24 find Mail -type d
25 ],
26 [0],
27 [Mail
28 Mail/inbox
29 ])
30
31 MH_CHECK([rmf],[rmf01 rmf_cur],[
32 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
33 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail])
34 echo 'Current-Folder: teaparty' > Mail/context
35 rmf || exit $?
36 find Mail -type d
37 ],
38 [0],
39 [[[+inbox now current]]
40 Mail
41 Mail/inbox
42 ])
43
44 m4_popdef[MH_KEYWORDS])
45 # End of rmf.at
1 # This file is part of GNU Mailutils. -*- Autotest -*-
2 # Copyright (C) 2010 Free Software Foundation, Inc.
3 #
4 # GNU Mailutils is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3, or (at
7 # your option) any later version.
8 #
9 # GNU Mailutils is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
16
17 m4_pushdef[MH_KEYWORDS],[rmm])
18
19 MH_CHECK([rmm msg],[rmm00 rmm-msg],[
20 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
21 echo 'Current-Folder: inbox' > Mail/context
22 rmm 4 || exit $?
23 find Mail/inbox -name '[[0-9]]' | sort
24 ],
25 [0],
26 [Mail/inbox/1
27 Mail/inbox/2
28 Mail/inbox/3
29 Mail/inbox/5
30 ])
31
32 MH_CHECK([rmm seq],[rmm01 rmm-seq],[
33 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
34 echo 'Current-Folder: inbox' > Mail/context
35 cat > Mail/inbox/.mh_sequences <<EOT
36 test: 2 3 5
37 cur: 1
38 EOT
39 rmm test || exit $?
40 find Mail/inbox -name '[[0-9]]' | sort
41 sed '/^$/d' Mail/inbox/.mh_sequences
42 ],
43 [0],
44 [Mail/inbox/1
45 Mail/inbox/4
46 test: 2 3 5
47 cur: 1
48 ])
49
50 m4_popdef[MH_KEYWORDS])
51 # End of rmm.at
1 # This file is part of GNU Mailutils. -*- Autotest -*-
2 # Copyright (C) 2010 Free Software Foundation, Inc.
3 #
4 # GNU Mailutils is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3, or (at
7 # your option) any later version.
8 #
9 # GNU Mailutils is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
16
17 m4_pushdef[MH_KEYWORDS],[scan])
18
19 MH_CHECK([scan],[scan00],[
20 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
21 echo "Current-Folder: inbox" > Mail/context
22 scan | sed 's/ *$//'
23 ],
24 [0],
25 [ 1 12/28 Foo Bar <foobar@n Jabberwocky<<`Twas brillig, and the slithy toves
26 2 12/28 Bar <bar@dontmail Re: Jabberwocky<<It seems very pretty, but it's
27 3 07/13 Sergey Poznyakoff Simple MIME<<------- =_aaaaaaaaaa0 Content-Type:
28 4 07/13 Sergey Poznyakoff Nested MIME<<------- =_aaaaaaaaaa0 Content-Type:
29 5 07/13 Sergey Poznyakoff Empty MIME Parts<<------- =_aaaaaaaaaa0 Content-
30 ])
31
32 MH_CHECK([scan -folder],[scan01 scan-folder],[
33 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail/inbox])
34 scan +inbox | sed 's/ *$//'
35 ],
36 [0],
37 [ 1 12/28 Foo Bar <foobar@n Jabberwocky<<`Twas brillig, and the slithy toves
38 2 12/28 Bar <bar@dontmail Re: Jabberwocky<<It seems very pretty, but it's
39 3 07/13 Sergey Poznyakoff Simple MIME<<------- =_aaaaaaaaaa0 Content-Type:
40 4 07/13 Sergey Poznyakoff Nested MIME<<------- =_aaaaaaaaaa0 Content-Type:
41 5 07/13 Sergey Poznyakoff Empty MIME Parts<<------- =_aaaaaaaaaa0 Content-
42 ])
43
44 MH_CHECK([scan -format],[scan02 scan-format],[
45 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail])
46 scan +mbox1 -format '%4(msg) %(decode(friendly{from})) - %(decode(friendly{to}))'
47 ],
48 [0],
49 [ 1 Foo Bar <foobar@nonexistent.net> - Bar <bar@dontmailme.org>
50 2 Bar <bar@dontmailme.org> - Foo Bar <foobar@nonexistent.net>
51 3 Sergey Poznyakoff <gray@Mirddin.farlep.net> - Foo Bar <foobar@nonexistent.
52 4 Sergey Poznyakoff <gray@Mirddin.farlep.net> - Foo Bar <foobar@nonexistent.
53 5 Sergey Poznyakoff <gray@Mirddin.farlep.net> - Foo Bar <foobar@nonexistent.
54 ])
55
56 MH_CHECK([scan -form],[scan03 scan-form],[
57 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail])
58 echo '%4(msg) %(decode(friendly{from})) - %(decode(friendly{to}))' > formfile
59 scan +mbox1 -form formfile
60 ],
61 [0],
62 [ 1 Foo Bar <foobar@nonexistent.net> - Bar <bar@dontmailme.org>
63 2 Bar <bar@dontmailme.org> - Foo Bar <foobar@nonexistent.net>
64 3 Sergey Poznyakoff <gray@Mirddin.farlep.net> - Foo Bar <foobar@nonexistent.
65 4 Sergey Poznyakoff <gray@Mirddin.farlep.net> - Foo Bar <foobar@nonexistent.
66 5 Sergey Poznyakoff <gray@Mirddin.farlep.net> - Foo Bar <foobar@nonexistent.
67 ])
68
69 MH_CHECK([scan -reverse],[scan04 scan-reverse],[
70 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/mbox1,[Mail])
71 scan +mbox1 -reverse | sed 's/ *$//'
72 ],
73 [0],
74 [ 5 07/13 Sergey Poznyakoff Empty MIME Parts<<------- =_aaaaaaaaaa0 Content-
75 4 07/13 Sergey Poznyakoff Nested MIME<<------- =_aaaaaaaaaa0 Content-Type:
76 3 07/13 Sergey Poznyakoff Simple MIME<<------- =_aaaaaaaaaa0 Content-Type:
77 2 12/28 Bar <bar@dontmail Re: Jabberwocky<<It seems very pretty, but it's
78 1 12/28 Foo Bar <foobar@n Jabberwocky<<`Twas brillig, and the slithy toves
79 ])
80
81 m4_popdef[MH_KEYWORDS])
82 # End of scan.at
1 # This file is part of GNU Mailutils. -*- Autotest -*-
2 # Copyright (C) 2010 Free Software Foundation, Inc.
3 #
4 # GNU Mailutils is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3, or (at
7 # your option) any later version.
8 #
9 # GNU Mailutils is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
16
17 m4_include([testsuite.inc])
18
19 m4_define([MH_SETUP],[
20 test -d Mail || mkdir Mail
21 dir=`pwd`
22 MH=$dir/mh_profile
23 export MH
24 echo "Path: $dir/Mail" > $MH
25 exec <&-
26 ])
27
28 m4_define([MH_KEYWORDS])
29
30 dnl --------------------------------------------------------------
31 dnl MH_CHECK(DESCR, [KW = `'], COMMANDS, [STATUS = `0'],
32 dnl [STDOUT = `'], [STDERR = `']
33 dnl
34 m4_define([MH_CHECK],[
35 AT_SETUP($1)
36 AT_KEYWORDS(MH_KEYWORDS[ $2])
37 MH_SETUP
38 AT_CHECK([$3],[$4],[$5],[$6])
39 AT_CLEANUP
40 ])
41
42 AT_INIT
43
44 m4_include([folder.at])
45 m4_include([inc.at])
46 m4_include([scan.at])
47 m4_include([rmm.at])
48 m4_include([rmf.at])
49 m4_include([mark.at])
50 m4_include([mhparam.at])
51 m4_include([refile.at])
52 m4_include([mhpath.at])
...@@ -78,6 +78,9 @@ AM_CPPFLAGS = \ ...@@ -78,6 +78,9 @@ AM_CPPFLAGS = \
78 -DPYTHON_LIBS="\"$(PYTHON_LIBS)\"" \ 78 -DPYTHON_LIBS="\"$(PYTHON_LIBS)\"" \
79 -DI18NLIBS="\"$(LIBINTL)\"" 79 -DI18NLIBS="\"$(LIBINTL)\""
80 80
81 BUILD_SOURCES=mu-setup.c mu-setup.h
82 EXTRA_DIST=mu-setup.c mu-setup.h
83
81 mu-setup.h: Makefile.am $(MODULES) $(IDLE_MODULES) 84 mu-setup.h: Makefile.am $(MODULES) $(IDLE_MODULES)
82 $(AM_V_GEN)$(AWK) -f $(top_srcdir)/mu/mu-setup.awk -v mode=h \ 85 $(AM_V_GEN)$(AWK) -f $(top_srcdir)/mu/mu-setup.awk -v mode=h \
83 $(MODULES) $(IDLE_MODULES) > mu-setup.h 86 $(MODULES) $(IDLE_MODULES) > mu-setup.h
......
...@@ -44,14 +44,18 @@ AT_CLEANUP ...@@ -44,14 +44,18 @@ AT_CLEANUP
44 ]) 44 ])
45 45
46 dnl ------------------------------------------------------------ 46 dnl ------------------------------------------------------------
47 dnl MUT_MBCOPY(SRC, DST) -- Copy mailbox SRC to DST. 47 dnl MUT_MBCOPY(SRC, [DST = `.']) -- Copy mailbox SRC to DST.
48 dnl 48 dnl
49 dnl 49 dnl
50 m4_define([MUT_MBCOPY],[ 50 m4_define([MUT_MBCOPY],[
51 m4_pushdef([__dst],[m4_if([$2],,[.],[$2])]) 51 m4_pushdef([__dst],[m4_if([$2],,[.],[$2])])
52 m4_pushdef([__basename],[m4_bregexp($1,[.*/\([^/]+\)$],\1)]) 52 m4_pushdef([__basename],[m4_bregexp($1,[.*/\([^/]+\)$],\1)])
53 cp -r $1 __dst 53 cp -r $1 __dst
54 chmod -R +w __dst/__basename 54 if test -e __dst/__basename; then
55 chmod -R +w __dst/__basename
56 else
57 chmod -R +w __dst
58 fi
55 m4_popdef([__basename]) 59 m4_popdef([__basename])
56 m4_popdef([__dst]) 60 m4_popdef([__dst])
57 ]) 61 ])
......