File: header-pairs.t

package info (click to toggle)
libemail-simple-perl 2.218-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 336 kB
  • sloc: perl: 462; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 903 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use v5.12.0;
use warnings;

use Test::More tests => 3;

use_ok 'Email::Simple';

my $email = Email::Simple->new(<<'__MESSAGE__');
From: casey@geeknest.example.com
X-Your-Face: your face is your face
To: drain@example.com
X-Your-Face: your face is my face
X-Your-Face: from california
Reply-To: xyzzy@plugh.example.net
X-Your-Face: to the new york islface
Subject: Message in a bottle

HELP!
__MESSAGE__

can_ok $email, 'header_names';

my @header_pairs = $email->header_pairs;
is_deeply(
  \@header_pairs,
  [
    'From',        'casey@geeknest.example.com',
    'X-Your-Face', 'your face is your face',
    'To',          'drain@example.com',
    'X-Your-Face', 'your face is my face',
    'X-Your-Face', 'from california',
    'Reply-To',    'xyzzy@plugh.example.net',
    'X-Your-Face', 'to the new york islface',
    'Subject',     'Message in a bottle',
  ],
  "header pairs came out properly",
);