-
Notifications
You must be signed in to change notification settings - Fork 70
/
recreate.t
executable file
·71 lines (60 loc) · 1.59 KB
/
recreate.t
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/perl -T
use Data::Dumper;
use lib '.'; use lib 't';
use SATest; sa_t_init("recreate");
use Test::More tests => 9;
use strict;
use warnings;
use Mail::SpamAssassin;
our $warning = 0;
$SIG{'__WARN__'} = sub {
print STDERR @_;
# certain warnings can be ignored for this test
if ($_[0] =~ m{plugin: failed to parse plugin.*: Can.t locate } ||
$_[0] =~ m{is more clearly written simply as .* in regex} ||
$_[0] =~ m{Ranges of ASCII printables should be some subset of .* in regex})
{
print STDERR "[ignored warning, not recreate-related]\n";
} else {
++$warning;
}
};
my $spamtest = Mail::SpamAssassin->new({
rules_filename => $localrules,
site_rules_filename => $siterules,
userprefs_filename => $userrules,
local_tests_only => 1,
debug => 0,
dont_copy_prefs => 1,
});
$spamtest->init(0); # parse rules
ok($spamtest);
open (IN, "<data/spam/009");
my $dataref = [<IN>];
close IN;
my $mail = $spamtest->parse($dataref);
ok($mail);
my $status = $spamtest->check($mail);
ok($status);
my $output = $status->get_report();
ok($output);
$status->finish();
$mail->finish();
$spamtest->finish();
$spamtest = Mail::SpamAssassin->new({
rules_filename => $localrules,
site_rules_filename => $siterules,
userprefs_filename => $userrules,
local_tests_only => 1,
debug => 0,
dont_copy_prefs => 1,
});
$spamtest->init(0); # parse rules
ok($spamtest);
$mail = $spamtest->parse($dataref);
ok($mail);
$status = $spamtest->check($mail);
ok($status);
$output = $status->get_report();
ok($output);
ok($warning == 0);