1 # Copyright (C) 2016-2018 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 use PublicInbox::MID qw(mid_escape mids references);
6 is(mid_escape('foo!@(bar)'), 'foo!@(bar)');
7 is(mid_escape('foo%!@(bar)'), 'foo%25!@(bar)');
8 is(mid_escape('foo%!@(bar)'), 'foo%25!@(bar)');
12 my $mime = Email::MIME->create;
13 $mime->header_set('Message-Id', '<mid-1@a>');
14 is_deeply(['mid-1@a'], mids($mime->header_obj), 'mids in common case');
15 $mime->header_set('Message-Id', '<mid-1@a>', '<mid-2@b>');
16 is_deeply(['mid-1@a', 'mid-2@b'], mids($mime->header_obj), '2 mids');
17 $mime->header_set('Message-Id', '<mid-1@a>', '<mid-1@a>');
18 is_deeply(['mid-1@a'], mids($mime->header_obj), 'dup mids');
19 $mime->header_set('Message-Id', '<mid-1@a> comment');
20 is_deeply(['mid-1@a'], mids($mime->header_obj), 'comment ignored');
21 $mime->header_set('Message-Id', 'bare-mid');
22 is_deeply(['bare-mid'], mids($mime->header_obj), 'bare mid OK');
24 $mime->header_set('References', '<hello> <world>');
25 $mime->header_set('In-Reply-To', '<weld>');
26 is_deeply(['hello', 'world', 'weld'], references($mime->header_obj),
27 'references combines with In-Reply-To');