| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mail::Action::AddressTest; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
726
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
36
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
31
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'Test::Class'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
1460
|
|
|
7
|
1
|
|
|
1
|
|
82541
|
use Test::More; |
|
|
1
|
|
|
|
|
29480
|
|
|
|
1
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
6
|
|
|
6
|
0
|
16
|
sub module { 'Mail::Action::Address::Base' }; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub startup :Test( startup => 2 ) |
|
12
|
|
|
|
|
|
|
{ |
|
13
|
1
|
|
|
1
|
0
|
3700
|
my $self = shift; |
|
14
|
1
|
|
|
|
|
6
|
my $module = $self->module(); |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
138
|
use_ok( 'Mail::Action::Address' ); |
|
|
1
|
|
|
|
|
172
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
22
|
|
|
|
1
|
|
|
|
|
22
|
|
|
17
|
1
|
|
|
1
|
|
828
|
use_ok( $module ); |
|
|
1
|
|
|
|
|
102
|
|
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
18
|
1
|
|
|
1
|
|
444
|
} |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
10
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub setup :Test( setup => 1 ) |
|
21
|
|
|
|
|
|
|
{ |
|
22
|
4
|
|
|
4
|
0
|
12519
|
my $self = shift; |
|
23
|
4
|
|
|
|
|
22
|
my $module = $self->module(); |
|
24
|
4
|
|
|
|
|
24
|
$self->{address} = $module->new(); |
|
25
|
|
|
|
|
|
|
|
|
26
|
4
|
|
|
|
|
46
|
isa_ok( $self->{address}, $module ); |
|
27
|
1
|
|
|
1
|
|
747
|
} |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub test_description :Test( 4 ) |
|
30
|
|
|
|
|
|
|
{ |
|
31
|
1
|
|
|
1
|
0
|
1013
|
my $self = shift; |
|
32
|
1
|
|
|
|
|
4
|
my $add = $self->{address}; |
|
33
|
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
6
|
can_ok( $add, 'description' ); |
|
35
|
1
|
|
|
|
|
834
|
is( $add->description(), '', |
|
36
|
|
|
|
|
|
|
'description() should be blank unless set in constructor' ); |
|
37
|
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
1485
|
$add->{description} = 'now set'; |
|
39
|
1
|
|
|
|
|
6
|
is( $add->description(), 'now set', |
|
40
|
|
|
|
|
|
|
'... or whatever is set in constructor' ); |
|
41
|
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
653
|
$add->description( 'set here' ); |
|
43
|
1
|
|
|
|
|
4
|
is( $add->description(), 'set here', |
|
44
|
|
|
|
|
|
|
'... and should be able to set description' ); |
|
45
|
1
|
|
|
1
|
|
4125
|
} |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub test_name :Test( 4 ) |
|
48
|
|
|
|
|
|
|
{ |
|
49
|
1
|
|
|
1
|
0
|
1349
|
my $self = shift; |
|
50
|
1
|
|
|
|
|
4
|
my $add = $self->{address}; |
|
51
|
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
5
|
can_ok( $add, 'name' ); |
|
53
|
1
|
|
|
|
|
836
|
is( $add->name(), undef, |
|
54
|
|
|
|
|
|
|
'name() should be undef unless set in constructor' ); |
|
55
|
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
615
|
$add->{name} = 'newname'; |
|
57
|
1
|
|
|
|
|
6
|
is( $add->name(), 'newname', '... or whatever is set' ); |
|
58
|
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
1248
|
$add->name( '!my Name$ ' ); |
|
60
|
1
|
|
|
|
|
4
|
is( $add->name(), 'myName', '... or cleaned name, if mutator' ); |
|
61
|
1
|
|
|
1
|
|
504
|
} |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub test_process_time :Test( 8 ) |
|
64
|
|
|
|
|
|
|
{ |
|
65
|
1
|
|
|
1
|
0
|
1058
|
my $self = shift; |
|
66
|
1
|
|
|
|
|
3
|
my $add = $self->{address}; |
|
67
|
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
6
|
can_ok( $add, 'process_time' ); |
|
69
|
|
|
|
|
|
|
|
|
70
|
1
|
|
|
|
|
737
|
is( $add->process_time( 100 ), 100, |
|
71
|
|
|
|
|
|
|
'process_time() should return raw seconds directly' ); |
|
72
|
1
|
|
|
|
|
643
|
is( $add->process_time( '1d' ), 24 * 60 * 60, |
|
73
|
|
|
|
|
|
|
'... processing days correctly' ); |
|
74
|
1
|
|
|
|
|
639
|
is( $add->process_time( '2w' ), 2 * 7 * 24 * 60 * 60, |
|
75
|
|
|
|
|
|
|
'... processing weeks correctly' ); |
|
76
|
1
|
|
|
|
|
592
|
is( $add->process_time( '4h' ), 4 * 60 * 60, |
|
77
|
|
|
|
|
|
|
'... processing hours correctly' ); |
|
78
|
1
|
|
|
|
|
536
|
is( $add->process_time( '8m' ), 8 * 60, |
|
79
|
|
|
|
|
|
|
'... processing minutes correctly' ); |
|
80
|
1
|
|
|
|
|
712
|
is( $add->process_time( '16M' ), 16 * 30 * 24 * 60 * 60, |
|
81
|
|
|
|
|
|
|
'... processing months correctly' ); |
|
82
|
1
|
|
|
|
|
580
|
is( $add->process_time( '1M2w3d4h5m' ), |
|
83
|
|
|
|
|
|
|
30 * 24 * 60 * 60 + |
|
84
|
|
|
|
|
|
|
2 * 7 * 24 * 60 * 60 + |
|
85
|
|
|
|
|
|
|
3 * 24 * 60 * 60 + |
|
86
|
|
|
|
|
|
|
4 * 60 * 60 + |
|
87
|
|
|
|
|
|
|
5 * 60, '... even in a nice list' ); |
|
88
|
1
|
|
|
1
|
|
438
|
} |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub test_expires :Test( 5 ) |
|
91
|
|
|
|
|
|
|
{ |
|
92
|
1
|
|
|
1
|
0
|
1083
|
my $self = shift; |
|
93
|
1
|
|
|
|
|
4
|
my $add = $self->{address}; |
|
94
|
1
|
|
|
|
|
5
|
my $module = $self->module(); |
|
95
|
|
|
|
|
|
|
|
|
96
|
1
|
|
|
|
|
5
|
can_ok( $add, 'expires' ); |
|
97
|
1
|
|
|
|
|
803
|
is( $add->expires(), 0, |
|
98
|
|
|
|
|
|
|
'expires() should default to 0 unless set in constructor' ); |
|
99
|
|
|
|
|
|
|
|
|
100
|
1
|
|
|
|
|
756
|
$add = $module->new( expires => 1003 ); |
|
101
|
1
|
|
|
|
|
5
|
is( $add->expires(), 1003, |
|
102
|
|
|
|
|
|
|
'expires() should report expiration time from constructor' ); |
|
103
|
|
|
|
|
|
|
|
|
104
|
1
|
|
|
|
|
663
|
my $expiration = time() + 100; |
|
105
|
1
|
|
|
|
|
6
|
$add->expires( 100 ); |
|
106
|
|
|
|
|
|
|
|
|
107
|
1
|
50
|
|
|
|
5
|
ok( $add->expires() - $expiration < 10, '... and should set expiration' ) |
|
108
|
|
|
|
|
|
|
or diag "Possible clock skew: (" . $add->expires() . |
|
109
|
|
|
|
|
|
|
") [$expiration]\n"; |
|
110
|
|
|
|
|
|
|
|
|
111
|
1
|
|
|
|
|
2485
|
my $time = time() + 7 * 24 * 60 * 60; |
|
112
|
1
|
|
|
|
|
16
|
is( $add->expires( '7d' ), $time, '... parsing days correctly' ); |
|
113
|
1
|
|
|
1
|
|
598
|
} |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
package Mail::Action::Address::Base; |
|
116
|
|
|
|
|
|
|
|
|
117
|
1
|
|
|
1
|
|
305
|
BEGIN { $INC{'Mail/Action/Address/Base.pm'} = 1 } |
|
118
|
|
|
|
|
|
|
|
|
119
|
1
|
|
|
1
|
|
939
|
use Mail::Action::Address; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
48
|
|
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
use Class::Roles |
|
122
|
1
|
|
|
|
|
7
|
does => 'address_expires', |
|
123
|
|
|
|
|
|
|
does => 'address_named', |
|
124
|
1
|
|
|
1
|
|
9
|
does => 'address_described'; |
|
|
1
|
|
|
|
|
2
|
|
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub new |
|
127
|
|
|
|
|
|
|
{ |
|
128
|
5
|
|
|
5
|
0
|
18
|
my ($class, %args) = @_; |
|
129
|
5
|
|
|
|
|
32
|
bless \%args, $class; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |