tlib/Test_Renaming.pm

filter: Statementstmt 73.9% 17 / 23 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 3 totaltotal 66.6% 24 / 36 CC 2 SCAR 3.7
CC
2
Cov
72%
import
2.0
install_hint_to
2.0
set_new_hint_to
2.0
CRAP 1.5
« tlib/Test_Global_Hints.pm ↑ Summary tlib/Test_Compiletime_Hints.pm »
1 package Test_Renaming;
2  
3 1 ▶use 5.010; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Lexical::Hints { set_hint => 'install_hint', get_hint => 'retrieve_hint' };
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # Initialize module's hints...
8 3 ▶sub import {
Subroutine import: called CC=2 SCAR=7.1
9 3 my ($package, $hint_value) = @_;
10 3 ▶ if (defined $hint_value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hint_value) 3 0 3
11 3 install_hint(cth => $hint_value);
12 }
13 }
14  
15 # Test hints are set...
16 6 ▶sub verify_hint_is {
Subroutine verify_hint_is: called CC=1 SCAR=0.0
Pod undocumented
17 6 my ($hint_value) = @_;
18 6 is retrieve_hint('cth'), $hint_value => "Verifying value is now: $hint_value";
19 }
20  
21 # Set hints...
22 0 ▶sub install_hint_to {
Subroutine install_hint_to: not called CC=1 SCAR=6.9
Pod undocumented
23 0 my ($hint_value) = @_;
24 0 install_hint('cth' => $hint_value);
25 }
26  
27 # Attempt to create a new hint...
28 0 ▶sub set_new_hint_to {
Subroutine set_new_hint_to: not called CC=1 SCAR=6.9
Pod undocumented
29 0 my ($hint_value) = @_;
30 0 is eval{ install_hint('new_cth' => $hint_value); }, undef() => 'Runtime autovivification failed';
31 0 like $@, qr{^Cannot autovivify hint 'new_cth' at runtime for Test_Compiletime_Hints}
32 => 'Correct error message';
33 }
34  
35 1 1; # Magic true value required at end of module
36  
« tlib/Test_Global_Hints.pm ↑ Summary tlib/Test_Compiletime_Hints.pm »