File: badly-folded.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 (35 lines) | stat: -rw-r--r-- 879 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
#!perl -w
use strict;
use Test::More tests => 5;

# This time, with folding!

use_ok("Email::Simple");
sub read_file { local $/; local *FH; open FH, shift or die $!; return <FH> }

{
  my $mail_text = read_file("t/test-mails/badly-folded");

  my $msg1 = Email::Simple->new($mail_text);
  my $msg2 = Email::Simple->new($msg1->as_string);

  is(
    $msg2->header('X-Sieve'),
    'CMU Sieve 2.2',
    "still have X-Sieve header after round trip",
  );
}

{
  my $mail_text = read_file("t/test-mails/badly-folded-noindent");

  my $msg1 = Email::Simple->new($mail_text);

  is($msg1->header('Bar'), 'Bar', "got first header ok");
  is(
    $msg1->header('Badly-Folded'),
    'This header is badly folded because even though it goes onto the second line, it has no indent.',
    "got badly folded, middle header OK",
  );
  is($msg1->header('Foo'), 'Foo', "got final header ok");
}