File: util-env.t

package info (click to toggle)
libemail-sender-perl 1.300031-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 528 kB
  • sloc: perl: 2,288; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 865 bytes parent folder | download | duplicates (8)
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
#!perl
use strict;
use warnings;
use Test::More tests => 2;

use Email::Sender::Transport;
use Email::Sender::Util;

my $message = <<'END';
From: "Ricardo O'Signes" <rjbs@example.com>
To: dude@example.com, <guy@example.com>, "I'm Not Your" <buddy@example.ca>
Cc: another <dude@example.com>, cc@cc.example.cc
Subject: sometimes people do dumb things
Cc: like <multiple@example.cc>
Bcc: bcc@example.biz

This is a test message.

-- 
rjbs
END

my $email = Email::Sender::Transport->prepare_email(\$message);

is_deeply(
  Email::Sender::Util->_sender_from_email($email),
  'rjbs@example.com',
  "we get the sender we expect",
);

is_deeply(
  [ sort @{ Email::Sender::Util->_recipients_from_email($email) } ],
  [ sort qw(dude@example.com guy@example.com buddy@example.ca cc@cc.example.cc
    multiple@example.cc bcc@example.biz) ],
  "we get the rcpts we expect",
);