File: if_can.t

package info (click to toggle)
spamassassin 3.4.0-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,296 kB
  • ctags: 2,968
  • sloc: perl: 54,007; ansic: 3,397; sh: 590; makefile: 195; sql: 176; python: 17
file content (72 lines) | stat: -rw-r--r-- 2,438 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/perl

use lib '.'; use lib 't';
use SATest; sa_t_init("if_can");
use Test; BEGIN { plan tests => 13 };

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

%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',

);
%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 !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();