line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mason::t::Globals; |
2
|
|
|
|
|
|
|
$Mason::t::Globals::VERSION = '2.23'; |
3
|
1
|
|
|
1
|
|
919
|
use Test::Class::Most parent => 'Mason::Test::Class'; |
|
1
|
|
|
|
|
36340
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub test_globals : Tests { |
6
|
1
|
|
|
1
|
0
|
644
|
my $self = shift; |
7
|
1
|
|
|
|
|
53
|
$self->setup_interp( allow_globals => [qw(scalar $scalar2)] ); |
8
|
1
|
|
|
|
|
27
|
my $interp = $self->interp; |
9
|
1
|
|
|
|
|
6
|
$interp->set_global( 'scalar', 5 ); |
10
|
1
|
|
|
|
|
3
|
$interp->set_global( '$scalar2', 'vanilla' ); |
11
|
1
|
|
|
1
|
|
10
|
throws_ok { $interp->set_global( '$bad', 8 ) } qr/\$bad is not in the allowed globals list/; |
|
1
|
|
|
|
|
112
|
|
12
|
1
|
|
|
|
|
766
|
$self->add_comp( |
13
|
|
|
|
|
|
|
path => '/values', |
14
|
|
|
|
|
|
|
src => ' |
15
|
|
|
|
|
|
|
scalar = <% $scalar %> |
16
|
|
|
|
|
|
|
$scalar2 = <% $scalar2 %> |
17
|
|
|
|
|
|
|
', |
18
|
|
|
|
|
|
|
); |
19
|
1
|
|
|
|
|
8
|
$self->test_comp( |
20
|
|
|
|
|
|
|
src => ' |
21
|
|
|
|
|
|
|
<& /values &> |
22
|
|
|
|
|
|
|
% $scalar++; |
23
|
|
|
|
|
|
|
% $scalar2 .= "s"; |
24
|
|
|
|
|
|
|
<& /values &> |
25
|
|
|
|
|
|
|
', |
26
|
|
|
|
|
|
|
expect => ' |
27
|
|
|
|
|
|
|
scalar = 5 |
28
|
|
|
|
|
|
|
$scalar2 = vanilla |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
scalar = 6 |
32
|
|
|
|
|
|
|
$scalar2 = vanillas |
33
|
|
|
|
|
|
|
', |
34
|
|
|
|
|
|
|
); |
35
|
1
|
|
|
1
|
|
299
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |