Debian Codegraph @

t/.svn/text-base/05_email.t.svn-base

raw
1 #!perl
2 use strict;
3 use warnings FATAL => 'all';
4
5 use Data::Dumper;
6 use Mail::Sendmail;
7 use MIME::Parser;
8 use Test::More tests => 7;
9 BEGIN { use_ok('Test::Email') };
10
11 #########################
12
13 my $parser = MIME::Parser->new();
14 $parser->interface(ENTITY_CLASS => 'Test::Email');
15 $parser->output_to_core(1); # no tmpfiles
16
17 # setup the email for testing
18 my $email = $parser->parse_data(<<'END');
19 From:<james@localhost>
20 To:<james@localhost>
21 Subject: Tester
22
23 This is the message
24 END
25
26 # pass some tests
27 $email->header_like('to', qr/localhost/, 'to');
28 $email->header_ok('from', '<james@localhost>', 'from');
29 $email->header_is('subject', 'Tester', 'subject');
30
31 $email->body_like(qr/^This is/, 'body_like');
32 $email->body_ok('This is the message', 'body_ok');
33 $email->body_is('This is the message', 'body_is');
34
35 __END__
36