line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mason::t::StaticSource; |
2
|
|
|
|
|
|
|
$Mason::t::StaticSource::VERSION = '2.24'; |
3
|
1
|
|
|
1
|
|
870
|
use Test::Class::Most parent => 'Mason::Test::Class'; |
|
1
|
|
|
|
|
28655
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
70
|
use Mason::Util qw(write_file touch_file); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
92
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub setup : Test(setup) { |
7
|
4
|
|
|
4
|
0
|
1147
|
my ($self) = @_; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
|
|
27
|
$self->setup_dirs(); |
10
|
4
|
|
|
|
|
100
|
$self->add_comp( |
11
|
|
|
|
|
|
|
path => "/ss/remove_component.mc", |
12
|
|
|
|
|
|
|
src => "I will be removed.\n", |
13
|
|
|
|
|
|
|
); |
14
|
4
|
|
|
|
|
15
|
$self->add_comp( |
15
|
|
|
|
|
|
|
path => "/ss/change_component.mc", |
16
|
|
|
|
|
|
|
src => "I will be changed.\n", |
17
|
|
|
|
|
|
|
); |
18
|
1
|
|
|
1
|
|
4
|
} |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub write_comp { |
21
|
2
|
|
|
2
|
0
|
16
|
my ( $self, $path, $contents ) = @_; |
22
|
2
|
|
|
|
|
13
|
my $source_file = $self->interp->load($path)->cmeta->source_file; |
23
|
2
|
|
|
|
|
9
|
write_file( $source_file, $contents ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub remove_comp { |
27
|
2
|
|
|
2
|
0
|
5
|
my ( $self, $path ) = @_; |
28
|
2
|
|
|
|
|
8
|
my $source_file = $self->interp->load($path)->cmeta->source_file; |
29
|
2
|
|
|
|
|
328
|
unlink($source_file); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub test_change_no_ss : Tests { |
33
|
1
|
|
|
1
|
0
|
191
|
my $self = shift; |
34
|
1
|
|
|
|
|
7
|
$self->test_comp( |
35
|
|
|
|
|
|
|
src => '<& /ss/change_component.mc &>', |
36
|
|
|
|
|
|
|
expect => 'I will be changed.', |
37
|
|
|
|
|
|
|
); |
38
|
1
|
|
|
|
|
1000197
|
sleep(1); # Make sure timestamp changes |
39
|
1
|
|
|
|
|
22
|
$self->write_comp( "/ss/change_component.mc", "I have changed!\n" ); |
40
|
1
|
|
|
|
|
8
|
$self->test_comp( |
41
|
|
|
|
|
|
|
src => '<& /ss/change_component.mc &>', |
42
|
|
|
|
|
|
|
expect => 'I have changed!', |
43
|
|
|
|
|
|
|
); |
44
|
1
|
|
|
1
|
|
331
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub test_change_and_touch_ss : Tests { |
47
|
1
|
|
|
1
|
0
|
632
|
my $self = shift; |
48
|
1
|
|
|
|
|
7
|
my $touch_file = $self->temp_dir . "/purge.dat"; |
49
|
1
|
|
|
|
|
10
|
$self->setup_interp( static_source => 1, static_source_touch_file => $touch_file ); |
50
|
1
|
|
|
|
|
23
|
$self->test_comp( |
51
|
|
|
|
|
|
|
src => '<& /ss/change_component.mc &>', |
52
|
|
|
|
|
|
|
expect => 'I will be changed.', |
53
|
|
|
|
|
|
|
); |
54
|
1
|
|
|
|
|
1000200
|
sleep(1); # Make sure timestamp changes |
55
|
1
|
|
|
|
|
22
|
$self->interp->load('/ss/change_component.mc'); |
56
|
1
|
|
|
|
|
14
|
$self->write_comp( "/ss/change_component.mc", "I have changed!\n" ); |
57
|
1
|
|
|
|
|
7
|
$self->test_comp( |
58
|
|
|
|
|
|
|
src => '<& /ss/change_component.mc &>', |
59
|
|
|
|
|
|
|
expect => 'I will be changed.', |
60
|
|
|
|
|
|
|
); |
61
|
1
|
|
|
|
|
5
|
touch_file($touch_file); |
62
|
1
|
|
|
|
|
6
|
$self->test_comp( |
63
|
|
|
|
|
|
|
src => '<& /ss/change_component.mc &>', |
64
|
|
|
|
|
|
|
expect => 'I have changed!', |
65
|
|
|
|
|
|
|
); |
66
|
1
|
|
|
1
|
|
279
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub test_remove_no_ss : Tests { |
69
|
1
|
|
|
1
|
0
|
201
|
my $self = shift; |
70
|
1
|
|
|
|
|
7
|
$self->test_comp( |
71
|
|
|
|
|
|
|
src => '<& /ss/remove_component.mc &>', |
72
|
|
|
|
|
|
|
expect => 'I will be removed.', |
73
|
|
|
|
|
|
|
); |
74
|
1
|
|
|
|
|
5
|
$self->remove_comp("/ss/remove_component.mc"); |
75
|
1
|
|
|
|
|
13
|
$self->test_comp( |
76
|
|
|
|
|
|
|
src => '<& /ss/remove_component.mc &>', |
77
|
|
|
|
|
|
|
expect_error => qr/could not find component/ |
78
|
|
|
|
|
|
|
); |
79
|
1
|
|
|
1
|
|
236
|
} |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub test_remove_and_touch_ss : Tests { |
82
|
1
|
|
|
1
|
0
|
207
|
my $self = shift; |
83
|
1
|
|
|
|
|
7
|
my $touch_file = $self->temp_dir . "/purge.dat"; |
84
|
1
|
|
|
|
|
6
|
$self->setup_interp( static_source => 1, static_source_touch_file => $touch_file ); |
85
|
1
|
|
|
|
|
24
|
$self->test_comp( |
86
|
|
|
|
|
|
|
src => '<& /ss/remove_component.mc &>', |
87
|
|
|
|
|
|
|
expect => 'I will be removed.', |
88
|
|
|
|
|
|
|
); |
89
|
1
|
|
|
|
|
5
|
$self->remove_comp("/ss/remove_component.mc"); |
90
|
1
|
|
|
|
|
6
|
$self->test_comp( |
91
|
|
|
|
|
|
|
src => '<& /ss/remove_component.mc &>', |
92
|
|
|
|
|
|
|
expect => 'I will be removed.', |
93
|
|
|
|
|
|
|
); |
94
|
1
|
|
|
|
|
7
|
touch_file($touch_file); |
95
|
1
|
|
|
|
|
10
|
$self->test_comp( |
96
|
|
|
|
|
|
|
src => '<& /ss/remove_component.mc &>', |
97
|
|
|
|
|
|
|
expect_error => qr/could not find component/ |
98
|
|
|
|
|
|
|
); |
99
|
1
|
|
|
1
|
|
355
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |