diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-02-12 23:09:07 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-02-12 23:09:07 +0000 |
commit | ccafffd2888ae58be036b35e2323c2126fa633c9 (patch) | |
tree | 38aa5a41f32a0268c56a9d7cd7ab07f0f6a406cb /t/content_id.t | |
parent | e91932f5bc0ac966fee27913440627fa5447c6c7 (diff) | |
download | public-inbox-ccafffd2888ae58be036b35e2323c2126fa633c9.tar.gz |
Diffstat (limited to 't/content_id.t')
-rw-r--r-- | t/content_id.t | 24 |
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(); |