File: plain_uc_wc_unsent.t

package info (click to toggle)
libemail-outlook-message-perl 0.917-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 252 kB
  • ctags: 58
  • sloc: perl: 811; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 1,379 bytes parent folder | download | duplicates (3)
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
# Test unsent plain text message, unicode encoded, with a non-ascii
# codepoint ('wide character') in the body.
use strict;
use warnings;

# Needed to recoginize UTF8 string literal for comparing the body.
use utf8;

use Test::More tests => 14;
use Email::Outlook::Message;

my $p = new Email::Outlook::Message('t/files/plain_uc_wc_unsent.msg');
ok($p, "Parsing succeeded");
my $m = $p->to_email_mime;
is(scalar($m->header_names), 6, "Six headers");

is($m->header("Subject"), "Test for MSGConvert -- plain text", "Testing subject");
is($m->header("Date"), "Mon, 26 Feb 2007 22:57:01 +0000", "Testing date");
is($m->header("From"), undef, "No from specified");
is($m->header("To"), "Someone Else <someone\@somewhere\.com>", "Testing to");

like($m->content_type, qr{^multipart/alternative}, "Content type should be multipart/alternative");
my @parts = $m->subparts;
is(scalar(@parts), 2, "Two sub-parts");

my $text = $parts[0];
like($text->content_type, qr{^text/plain}, "Content type should be text/plain");
is($text->body, "This is a test\r\nThe body is in p汬ain text", "Check body");
is(scalar($text->subparts), 0, "No sub-parts");

my $rtf = $parts[1];
like($rtf->content_type, qr{^application/rtf}, "Content type should be application/rtf");
is($rtf->header("Content-Disposition"), "inline", "Testing content disposition");
is(scalar($rtf->subparts), 0, "No sub-parts");