summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-11-15 14:48:51 +0200
committerSergey Poznyakoff <gray@gnu.org>2020-11-15 14:48:51 +0200
commit337c75cb685ce96a41d10738f26f04de6a2bebed (patch)
tree26f9ff3b00c5c2b652515d0d98dce41c37f515e2
parentb76bf9c144c9f1fa8f31aa1480acc5989131e904 (diff)
downloadmailutils-337c75cb685ce96a41d10738f26f04de6a2bebed.tar.gz
mailutils-337c75cb685ce96a41d10738f26f04de6a2bebed.tar.bz2
Add maildir format detection test
* libproto/maildir/tests/Makefile.am: Add autodetect.at. * libproto/maildir/tests/testsuite.at: Include autodetect.at. * libproto/maildir/tests/autodetect.at: New file. * testsuite/mbop.c: Fix exit code for --detect.
-rw-r--r--libproto/maildir/tests/Makefile.am1
-rw-r--r--libproto/maildir/tests/autodetect.at32
-rw-r--r--libproto/maildir/tests/testsuite.at2
-rw-r--r--testsuite/mbop.c2
4 files changed, 36 insertions, 1 deletions
diff --git a/libproto/maildir/tests/Makefile.am b/libproto/maildir/tests/Makefile.am
index d8170ef8c..85ab4659a 100644
--- a/libproto/maildir/tests/Makefile.am
+++ b/libproto/maildir/tests/Makefile.am
@@ -41,6 +41,7 @@ TESTSUITE_AT += \
append.at\
attr.at\
attfixup.at\
+ autodetect.at\
body.at\
count.at\
delete.at\
diff --git a/libproto/maildir/tests/autodetect.at b/libproto/maildir/tests/autodetect.at
new file mode 100644
index 000000000..dd29dae2e
--- /dev/null
+++ b/libproto/maildir/tests/autodetect.at
@@ -0,0 +1,32 @@
+# GNU Mailutils -- a suite of utilities for electronic mail
+# Copyright (C) 2020 Free Software Foundation, Inc.
+#
+# This library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This library 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([format detection])
+AT_KEYWORDS([autodetect])
+AT_CHECK([
+mkdir inbox inbox/cur inbox/new
+mbop -m inbox --detect
+],
+[1],
+[inbox: 0
+])
+AT_CHECK([
+mkdir inbox/tmp
+mbop -m inbox --detect
+],
+[0],
+[inbox: 2
+])
+AT_CLEANUP
diff --git a/libproto/maildir/tests/testsuite.at b/libproto/maildir/tests/testsuite.at
index ff63390e8..c1bbc40eb 100644
--- a/libproto/maildir/tests/testsuite.at
+++ b/libproto/maildir/tests/testsuite.at
@@ -17,6 +17,8 @@
m4_include([testsuite.inc])
AT_INIT
+m4_include([autodetect.at])
+
m4_include([count.at])
m4_include([attr.at])
diff --git a/testsuite/mbop.c b/testsuite/mbop.c
index dea2025fb..bfaab0550 100644
--- a/testsuite/mbop.c
+++ b/testsuite/mbop.c
@@ -517,7 +517,7 @@ main (int argc, char **argv)
n = mu_record_is_scheme (rec, url, MU_FOLDER_ATTRIBUTE_FILE);
mu_printf ("%s: %d\n", env.mbxname, n);
mu_url_destroy (&url);
- exit (n != 0);
+ exit (n & MU_FOLDER_ATTRIBUTE_FILE ? 0 : 1);
}
MU_ASSERT (mu_mailbox_create_default (&env.mbx, env.mbxname));

Return to:

Send suggestions and report system problems to the System administrator.