about summary refs log tree commit homepage
path: root/t/content_id.t
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-02-12 23:09:07 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-02-12 23:09:07 +0000
commitccafffd2888ae58be036b35e2323c2126fa633c9 (patch)
tree38aa5a41f32a0268c56a9d7cd7ab07f0f6a406cb /t/content_id.t
parente91932f5bc0ac966fee27913440627fa5447c6c7 (diff)
downloadpublic-inbox-ccafffd2888ae58be036b35e2323c2126fa633c9.tar.gz
Diffstat (limited to 't/content_id.t')
-rw-r--r--t/content_id.t24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/content_id.t b/t/content_id.t
new file mode 100644
index 00000000..c0ae6ecd
--- /dev/null
+++ b/t/content_id.t
@@ -0,0 +1,24 @@
+# Copyright (C) 2018 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+use strict;
+use warnings;
+use Test::More;
+use PublicInbox::ContentId qw(content_id);
+use Email::MIME;
+
+my $mime = Email::MIME->create(
+        header => [
+                From => 'a@example.com',
+                To => 'b@example.com',
+                'Content-Type' => 'text/plain',
+                Subject => 'this is a subject',
+                'Message-ID' => '<a@example.com>',
+                Date => 'Fri, 02 Oct 1993 00:00:00 +0000',
+        ],
+        body => "hello world\n",
+);
+
+my $res = content_id($mime);
+like($res, qr/\ASHA-256:[a-f0-9]{64}\z/, 'cid in format expected');
+
+done_testing();