File: basic_lint_without_plugins.t

package info (click to toggle)
spamassassin 4.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,724 kB
  • sloc: perl: 89,143; ansic: 5,193; sh: 3,737; javascript: 339; sql: 295; makefile: 209; python: 49
file content (53 lines) | stat: -rwxr-xr-x 1,291 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl -T

use lib '.'; use lib 't';
use SATest; sa_t_init("basic_lint_without_plugins");

use Test::More;

plan tests => 4;

# ---------------------------------------------------------------------------

%patterns = (
  qr/^/, 'anything',
);
%anti_patterns = (
  q{ . }, 'should be silent on success',
);

# override locale for this test!
$ENV{'LANGUAGE'} = $ENV{'LC_ALL'} = 'C';

# Comment out any loadplugin other than Check
foreach $tainted (<$workdir/*/*.pre>) {
  $tainted =~ /(.*)/;
  my $file = $1;
  open(IN, $file)  or die;
  open(OUT, ">$file.tmp")  or die;
  while (<IN>) {
    s/^loadplugin(?!.*::Check\b)/#loadplugin/;
    print OUT $_  or die;
  }
  close OUT  or die;
  close IN  or die;
  rename("$file.tmp", "$file")  or die;
}
# Just want to test sa-update rules
unlink("$localrules/01_test_rules.cf");
unlink("$localrules/99_test_default.cf");

my $scoresfile  = "$localrules/50_scores.cf";

# when running from the built tarball or make disttest, we will not have a full
# rules dir -- therefore no 50_scores.cf,
# so we can use that to tell if this is the case
SKIP: {
  skip( "Not on a repo checkout", 4 ) unless -f $scoresfile;

  sarun ("--lint", \&patterns_run_cb);
  ok_all_patterns();
  sarun ("--lint --net", \&patterns_run_cb);
  ok_all_patterns();
}