| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Zonemaster::Engine::Test::Example; |
|
2
|
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
12816
|
use version; our $VERSION = version->declare("v1.0.3"); |
|
|
26
|
|
|
|
|
64
|
|
|
|
26
|
|
|
|
|
195
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
### |
|
6
|
|
|
|
|
|
|
### This test module is meant to serve as an example when writing proper ones. |
|
7
|
|
|
|
|
|
|
### |
|
8
|
|
|
|
|
|
|
|
|
9
|
26
|
|
|
26
|
|
2404
|
use strict; |
|
|
26
|
|
|
|
|
57
|
|
|
|
26
|
|
|
|
|
550
|
|
|
10
|
26
|
|
|
26
|
|
123
|
use warnings; |
|
|
26
|
|
|
|
|
53
|
|
|
|
26
|
|
|
|
|
665
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
26
|
|
|
26
|
|
513
|
use 5.014002; |
|
|
26
|
|
|
|
|
1932
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
26
|
|
|
26
|
|
150
|
use Zonemaster::Engine; |
|
|
26
|
|
|
|
|
75
|
|
|
|
26
|
|
|
|
|
464
|
|
|
15
|
26
|
|
|
26
|
|
115
|
use Zonemaster::Engine::Util; |
|
|
26
|
|
|
|
|
49
|
|
|
|
26
|
|
|
|
|
6216
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
### |
|
18
|
|
|
|
|
|
|
### Entry points |
|
19
|
|
|
|
|
|
|
### |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub all { |
|
22
|
0
|
|
|
0
|
1
|
0
|
my ( $class, $zone ) = @_; |
|
23
|
0
|
|
|
|
|
0
|
my @results; |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
0
|
push @results, $class->placeholder if Zonemaster::Engine->config->should_run( 'placeholder' ); |
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
0
|
return @results; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
### |
|
31
|
|
|
|
|
|
|
### Metadata Exposure |
|
32
|
|
|
|
|
|
|
### |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub metadata { |
|
35
|
2
|
|
|
2
|
1
|
4
|
my ( $class ) = @_; |
|
36
|
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
7
|
return { placeholder => [qw( EXAMPLE_TAG )] }; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub version { |
|
41
|
0
|
|
|
0
|
1
|
0
|
return "$Zonemaster::Engine::Test::Example::VERSION"; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub translation { |
|
45
|
1
|
|
|
1
|
1
|
5
|
return { EXAMPLE_TAG => 'This is an example tag.', }; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub policy { |
|
49
|
2
|
|
|
2
|
1
|
15
|
return { EXAMPLE_TAG => 'DEBUG', }; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
### |
|
53
|
|
|
|
|
|
|
### Tests |
|
54
|
|
|
|
|
|
|
### |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub placeholder { |
|
57
|
0
|
|
|
0
|
1
|
|
my ( $class, $zone ) = @_; |
|
58
|
0
|
|
|
|
|
|
my @results; |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
push @results, info( EXAMPLE_TAG => { example_arg => 'example_value' } ); |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return @results; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Zonemaster::Engine::Test::Example - example module showing the expected structure of Zonemaster test modules |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
my @results = Zonemaster::Engine::Test::Example->all($zone); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 METHODS |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=over |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item all($zone) |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Runs the default set of tests and returns a list of log entries made by the tests. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item metadata() |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Returns a reference to a hash, the keys of which are the names of all test methods in the module, and the corresponding values are references to |
|
86
|
|
|
|
|
|
|
lists with all the tags that the method can use in log entries. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item translation() |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Returns a reference to a nested hash, where the outermost keys are language |
|
91
|
|
|
|
|
|
|
codes, the keys below that are message tags and their values are translation |
|
92
|
|
|
|
|
|
|
strings. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item policy() |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Returns a reference to a hash with the default policy for the module. The keys |
|
97
|
|
|
|
|
|
|
are message tags, and the corresponding values are their default log levels. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item version() |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Returns a version string for the module. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=back |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 TESTS |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=over |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item placeholder($zone) |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Since this is an example module, this test does nothing except return a single log entry. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=back |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |