1 # Copyright (C) 2018-2020 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
6 use PublicInbox::ContentHash qw(content_hash);
9 my $mime = PublicInbox::Eml->new(<<'EOF');
12 Subject: this is a subject
13 Message-ID: <a@example.com>
14 Date: Fri, 02 Oct 1993 00:00:00 +0000
19 my $orig = content_hash($mime);
20 my $reload = content_hash(PublicInbox::Eml->new($mime->as_string));
21 is($orig, $reload, 'content_hash matches after serialization');
23 foreach my $h (qw(From To Cc)) {
24 my $n = q("Quoted N'Ame" <foo@EXAMPLE.com>);
25 $mime->header_set($h, "$n");
26 my $q = content_hash($mime);
27 is($mime->header($h), $n, "content_hash does not mutate $h:");
28 $mime->header_set($h, 'Quoted N\'Ame <foo@example.com>');
29 my $nq = content_hash($mime);
30 is($nq, $q, "quotes ignored in $h:");