File Coverage

tlib/Test_Renaming.pm
Criterion Covered Total %
statement 17 23 73.9
branch 1 2 50.0
condition n/a
subroutine 6 8 75.0
pod 0 3 0.0
total 24 36 66.6


line stmt bran cond sub pod time code
1             package Test_Renaming;
2              
3 1     1   29261 use 5.010; use warnings;
  1     1   3  
  1         49  
  1         6  
  1         2  
  1         41  
4 1     1   568 use Lexical::Hints { set_hint => 'install_hint', get_hint => 'retrieve_hint' };
  1         3  
  1         8  
5 1     1   7 use Test::More;
  1         1  
  1         9  
6              
7             # Initialize module's hints...
8             sub import {
9 3     3   5532 my ($package, $hint_value) = @_;
10 3 50       15 if (defined $hint_value) {
11 3         11 install_hint(cth => $hint_value);
12             }
13             }
14              
15             # Test hints are set...
16             sub verify_hint_is {
17 6     6 0 6093 my ($hint_value) = @_;
18 6         23 is retrieve_hint('cth'), $hint_value => "Verifying value is now: $hint_value";
19             }
20              
21             # Set hints...
22             sub install_hint_to {
23 0     0 0   my ($hint_value) = @_;
24 0           install_hint('cth' => $hint_value);
25             }
26              
27             # Attempt to create a new hint...
28             sub set_new_hint_to {
29 0     0 0   my ($hint_value) = @_;
30 0           is eval{ install_hint('new_cth' => $hint_value); }, undef() => 'Runtime autovivification failed';
  0            
31 0           like $@, qr{^Cannot autovivify hint 'new_cth' at runtime for Test_Compiletime_Hints}
32             => 'Correct error message';
33             }
34              
35             1; # Magic true value required at end of module
36