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