]> Sergey Matveev's repositories - public-inbox.git/blob - t/content_id.t
adcdb6c19a66a999f96189a75cc95a54aa2e62df
[public-inbox.git] / t / content_id.t
1 # Copyright (C) 2018 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3 use strict;
4 use warnings;
5 use Test::More;
6 use PublicInbox::ContentId qw(content_id);
7 use Email::MIME;
8
9 my $mime = Email::MIME->create(
10         header => [
11                 From => 'a@example.com',
12                 To => 'b@example.com',
13                 'Content-Type' => 'text/plain',
14                 Subject => 'this is a subject',
15                 'Message-ID' => '<a@example.com>',
16                 Date => 'Fri, 02 Oct 1993 00:00:00 +0000',
17         ],
18         body => "hello world\n",
19 );
20
21 my $orig = content_id($mime);
22 my $reload = content_id(Email::MIME->new($mime->as_string));
23 is($orig, $reload, 'content_id matches after serialization');
24
25 done_testing();