File: ct-header.t

package info (click to toggle)
libemail-simple-perl 2.004-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 232 kB
  • ctags: 27
  • sloc: perl: 615; makefile: 41
file content (38 lines) | stat: -rw-r--r-- 1,169 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
#!perl -w

use strict;

use Test::More tests => 4;

use Email::Simple;

# This asinine exception is made for Lotus Notes sending to Outlook.  When
# reconstituting this value (created by Lotus Notes), Outlook becomes unable to
# locate the MIME boundary.  The proper fix would be to note structure fields
# and analyze and reformat them correctly.  Fat chance.  -- rjbs, 2006-11-27

my $ct_text = qq{Content-Type: multipart/alternative; boundary="=_alternative 0065F3338525722E_="\n};

my $other_text = qq{Non-Content-Type: multipart/alternative; boundary="=_alternative 0065F3338525722E_="\n};

{
  my $count = my @lines = split /\n/, $other_text;
  is($count, 1, "we start with one line (non-Content-Type header)");
}

{
  my $email = Email::Simple->new($other_text);
  my $count = my @lines = split /\n/, $email->as_string;
  is($count, 2, "we end with two, because it wraps");
}

{
  my $count = my @lines = split /\n/, $ct_text;
  is($count, 1, "we start with one line (Content-Type header)");
}

{
  my $email = Email::Simple->new($ct_text);
  my $count = my @lines = split /\n/, $email->as_string;
  is($count, 1, "we end with one, because C-T doesn't wrap");
}