File: Email-Filter.t

package info (click to toggle)
libemail-filter-perl 1.03-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 84 kB
  • ctags: 22
  • sloc: perl: 113; makefile: 45
file content (28 lines) | stat: -rw-r--r-- 669 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
use Test::More 'no_plan';
use strict;
$^W = 1;
use File::Temp qw(tmpnam);
use_ok("Email::Filter");

open IN, "t/josey-nofold" or die $!;
my $mail;
{local $/; $mail = <IN>; }

my $x = Email::Filter->new(data => $mail);
isa_ok($x, "Email::Filter");
is($x->{noexit}, 0, "exit flag set correctly");

$x->exit(0);
is($x->{noexit}, 1, "exit flag set correctly");

my $where = tmpnam();
ok(!-f $where, "Just testing... (Going to $where)");
$x->accept($where);
ok(-f $where, "Delivered OK");
unlink $where;

my $y = $x->pipe("$^X", "-pe1"); # A sort of portable /bin/cat
is($y, $mail, "pipe works");

my $z = $x->pipe("$^X -pe1");
is $z, undef, 'pipe failed for broken input';