about summary refs log tree commit homepage
path: root/t/imap.t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-10 07:04:48 +0000
committerEric Wong <e@yhbt.net>2020-06-13 07:55:45 +0000
commit2963dfbc4c0625ebd2f4c0a2121825841605be2f (patch)
tree5d69e1c5cccb6e0cdcfbce4a4d24e76c7ebda498 /t/imap.t
parent0e6cf7c861657f79011b90036b5ade4d209ae60f (diff)
downloadpublic-inbox-2963dfbc4c0625ebd2f4c0a2121825841605be2f.tar.gz
None of the new cases are wired up, yet, but existing cases
still work.
Diffstat (limited to 't/imap.t')
-rw-r--r--t/imap.t15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/imap.t b/t/imap.t
index af59ef69..47e86ef4 100644
--- a/t/imap.t
+++ b/t/imap.t
@@ -9,6 +9,21 @@ use PublicInbox::IMAPD;
 use PublicInbox::TestCommon;
 require_mods(qw(DBD::SQLite));
 require_git 2.6;
+use POSIX qw(strftime);
+
+{
+        my $parse_date = \&PublicInbox::IMAP::parse_date;
+        is(strftime('%Y-%m-%d', gmtime($parse_date->('02-Oct-1993'))),
+                '1993-10-02', 'parse_date works');
+        is(strftime('%Y-%m-%d', gmtime($parse_date->('2-Oct-1993'))),
+                '1993-10-02', 'parse_date works w/o leading zero');
+
+        is($parse_date->('2-10-1993'), undef, 'bad month');
+
+        # from what I can tell, RFC 3501 says nothing about date-month
+        # case-insensitivity, so be case-sensitive for now
+        is($parse_date->('02-oct-1993'), undef, 'case-sensitive month');
+}
 
 my ($tmpdir, $for_destroy) = tmpdir();
 my $cfgfile = "$tmpdir/config";