File: if_can.t

package info (click to toggle)
spamassassin 3.4.2-1%2Bdeb10u3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 13,004 kB
  • sloc: perl: 57,283; ansic: 3,398; sh: 637; sql: 211; makefile: 200; python: 17
file content (84 lines) | stat: -rw-r--r-- 3,083 bytes parent folder | download | duplicates (2)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/perl

use lib '.'; use lib 't';
use SATest; sa_t_init("if_can");
use Test::More tests => 16;

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

%patterns = (

        q{ GTUBE }, 'gtube',
        q{ SHOULD_BE_CALLED1 }, 'should_be_called1',
        q{ SHOULD_BE_CALLED2 }, 'should_be_called2',
        q{ SHOULD_BE_CALLED3 }, 'should_be_called3',
        q{ SHOULD_BE_CALLED4 }, 'should_be_called4',
        q{ SHOULD_BE_CALLED5 }, 'should_be_called5',
        q{ SHOULD_BE_CALLED6 }, 'should_be_called6',
        q{ SHOULD_BE_CALLED7 }, 'should_be_called7',
        q{ SHOULD_BE_CALLED8 }, 'should_be_called8',
        q{ SHOULD_BE_CALLED9 }, 'should_be_called9',
        q{ SHOULD_BE_CALLED10 }, 'should_be_called10',

);
%anti_patterns = (

        q{ SHOULD_NOT_BE_CALLED1 }, 'should_not_be_called1',
        q{ SHOULD_NOT_BE_CALLED2 }, 'should_not_be_called2',
        q{ SHOULD_NOT_BE_CALLED3 }, 'should_not_be_called3',
        q{ SHOULD_NOT_BE_CALLED4 }, 'should_not_be_called4',

);
tstlocalrules (q{

        loadplugin Mail::SpamAssassin::Plugin::Test

        if (has(Mail::SpamAssassin::Plugin::Test::check_test_plugin))
          body SHOULD_BE_CALLED1 /./
        endif
        if (has(Mail::SpamAssassin::Plugin::Test::test_feature_xxxx_true))
          body SHOULD_BE_CALLED2 /./
        endif
        if (has(Mail::SpamAssassin::Plugin::Test::test_feature_xxxx_false))
          body SHOULD_BE_CALLED3 /./
        endif
        if (can(Mail::SpamAssassin::Plugin::Test::test_feature_xxxx_true))
          body SHOULD_BE_CALLED4 /./
        endif
        if (!can(Mail::SpamAssassin::Plugin::Test::test_feature_xxxx_false))
          body SHOULD_BE_CALLED5 /./
        endif
        if (!has(Mail::SpamAssassin::Plugin::Test::test_feature_xxxx_nosuch))
          body SHOULD_BE_CALLED6 /./
        endif
        if (!can(Mail::SpamAssassin::Plugin::Test::test_feature_xxxx_nosuch))
          body SHOULD_BE_CALLED7 /./
        endif
        if can(Mail::SpamAssassin::Plugin::Test::test_feature_xxxx_true) && version > 0.00000
          body SHOULD_BE_CALLED8 /./
        endif
        if !can(Mail::SpamAssassin::Plugin::Test::test_feature_xxxx_false  ) && !(! version > 0.00000)
          body SHOULD_BE_CALLED9 /./
        endif
        if has(Mail::SpamAssassin::Plugin::Test::test_feature_xxxx_true) && (!can(Mail::SpamAssassin::Plugin::Test::test_feature_xxxx_nosuch))
          body SHOULD_BE_CALLED10 /./
        endif

        if !has(Mail::SpamAssassin::Plugin::Test::check_test_plugin)
          body SHOULD_NOT_BE_CALLED1 /./
        endif
        if (has(Mail::SpamAssassin::Plugin::Test::non_existent_method))
          body SHOULD_NOT_BE_CALLED2 /./
        endif
        if (can(Mail::SpamAssassin::Plugin::Test::non_existent_method))
          body SHOULD_NOT_BE_CALLED3 /./
        endif
        if (can(Mail::SpamAssassin::Plugin::Test::test_feature_xxxx_false))
          body SHOULD_NOT_BE_CALLED4 /./
        endif

});

ok (sarun ("-L -t < data/spam/gtube.eml", \&patterns_run_cb));
ok_all_patterns();