File: ticket-60931.t

package info (click to toggle)
libmime-tools-perl 5.515-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,612 kB
  • sloc: perl: 6,349; makefile: 8
file content (37 lines) | stat: -rw-r--r-- 910 bytes parent folder | download | duplicates (7)
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
#!/usr/bin/perl
use Test::More tests => 2;
use MIME::Parser;

# RT#60931: Printing of empty preamble added extra newline before first boundary

my $original = do { local $/; <DATA> };
close(DATA);

my $generated = '';
my $fh = IO::File->new( \$generated, ">:" );

my $parser = MIME::Parser->new();
$parser->output_to_core(1);
my $entity = $parser->parse_data($original);
isa_ok( $entity, 'MIME::Entity');

$entity->print($fh);
$fh->close;
is( $original, $generated, 'Message with empty preamble roundtrips back to original');

__DATA__
MIME-Version: 1.0
Received: by 10.220.78.157 with HTTP; Thu, 26 Aug 2010 21:33:17 -0700 (PDT)
Content-Type: multipart/alternative; boundary=90e6ba4fc6ea25d329048ec69d99

--90e6ba4fc6ea25d329048ec69d99
Content-Type: text/plain; charset=ISO-8859-1

HELLO

--90e6ba4fc6ea25d329048ec69d99
Content-Type: text/html; charset=ISO-8859-1

HELLO<br>

--90e6ba4fc6ea25d329048ec69d99--