File: 05_email.t.svn-base

package info (click to toggle)
libtest-email-perl 0.07-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 224 kB
  • sloc: perl: 696; makefile: 2
file content (36 lines) | stat: -rwxr-xr-x 847 bytes parent folder | download | duplicates (6)
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
#!perl
use strict;
use warnings FATAL => 'all';

use Data::Dumper;
use Mail::Sendmail;
use MIME::Parser;
use Test::More tests => 7;
BEGIN { use_ok('Test::Email') };

#########################

my $parser = MIME::Parser->new();
$parser->interface(ENTITY_CLASS => 'Test::Email');
$parser->output_to_core(1); # no tmpfiles

# setup the email for testing
my $email = $parser->parse_data(<<'END');
From:<james@localhost>
To:<james@localhost>
Subject: Tester

This is the message
END

# pass some tests
$email->header_like('to', qr/localhost/, 'to');
$email->header_ok('from', '<james@localhost>', 'from');
$email->header_is('subject', 'Tester', 'subject');

$email->body_like(qr/^This is/, 'body_like');
$email->body_ok('This is the message', 'body_ok');
$email->body_is('This is the message', 'body_is');

__END__