| 12
 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
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 
 | #!/usr/bin/perl
use Data::Dumper;
use lib '.'; use lib 't';
use SATest; sa_t_init("recreate");
use Test;
BEGIN { 
  if (-e 't/test_dir') {
    chdir 't';
  }
  if (-e 'test_dir') {
    unshift(@INC, '../blib/lib');
  }
  plan tests => 9;
};
use strict;
use warnings;
use Mail::SpamAssassin;
my $prefix = '.';
if (-e 'test_dir') {            # running from test directory, not ..
  $prefix = '..';
}
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 })
  {
    print STDERR "[ignored warning, not recreate-related]\n";
  } else {
    ++$warning; 
  }
};
my $spamtest = Mail::SpamAssassin->new({
    rules_filename => "$prefix/t/log/test_rules_copy",
    site_rules_filename => "$prefix/t/log/localrules.tmp",
    userprefs_filename  => "$prefix/masses/spamassassin/user_prefs",
    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 => "$prefix/t/log/test_rules_copy",
    site_rules_filename => "$prefix/t/log/localrules.tmp",
    userprefs_filename  => "$prefix/masses/spamassassin/user_prefs",
    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);
 |