File: 423msgconv-emabs.t

package info (click to toggle)
libmail-message-perl 3.017-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,632 kB
  • sloc: perl: 11,156; makefile: 4
file content (60 lines) | stat: -rw-r--r-- 1,480 bytes parent folder | download | duplicates (4)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env perl
#
# Test coercion from Email::Abstract to Mail::Message

use strict;
use warnings;

use Mail::Message;
use Mail::Message::Test;

use Test::More;

BEGIN
{   eval { require Email::Abstract };
    if($@)
    {   plan skip_all => "requires Email::Abstract.";
        exit 0;
    }

    eval { require Email::Simple };
    if($@)
    {   plan skip_all => "requires Email::Simple.";
        exit 0;
    }

    plan tests => 6;
}

my $email = Email::Simple->new(<<'END_MESSAGE');
From: mailtools@overmeer.net
To: the users
Subject: use Mail::Box
In-Reply-To: <023984hjlur29420@sruoiu.nl>
X-Again: repeating header
X-Again: repeating header again
X-Again: repeating header and again

MIME::Entity is written by Eriq, and extends Mail::Internet with many
new capabilities, like multipart bodies.  Actually, although it says
to extend, it more or less reimplements most methods and conflicts
with the other.  Even the Mail::Internet constructor does not work:
only the build() can be used to safely construct a message.  Do not
use it anymore!
END_MESSAGE

isa_ok($email, 'Email::Simple');

is($email->header('in-reply-to'), '<023984hjlur29420@sruoiu.nl>');

my $abstract = Email::Abstract->new($email);

isa_ok($abstract, 'Email::Abstract');

is($abstract->get_header('in-reply-to'), '<023984hjlur29420@sruoiu.nl>');

my $message = Mail::Message->coerce($abstract);

isa_ok($message, 'Mail::Message');

is($message->get('in-reply-to'), '<023984hjlur29420@sruoiu.nl>');