t/lib/Punk/Command/Fakecmd.pm

filter: Statementstmt 81.2% 13 / 16 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod n/a totaltotal 72.0% 18 / 25 CC 2 SCAR 9.8
CC
2
Cov
70%
__ANON__
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« blib/lib/Punk/Test/WS/Conn.pm ↑ Summary blib/lib/Punk/Config.pm »
1 package Punk::Command::Fakecmd;
2  
3 # t/1311's plugin-seam fixture: bin/punk probes Punk::Command::<Ucfirst> on an
4 # unknown command, and loading the module IS the registration.
5  
6 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Punk::Command ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 Punk::Command->register(fakecmd => {
11 abstract => 'a test fixture',
12 hidden => 1,
13 options => [ { spec => 'shout', doc => 'upper case' } ],
14 0 ▶ code => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
15 0 my ($opt) = @_;
16 0 ▶ print $opt->{shout} ? "FAKE\n" : "fake\n";
Branch: 1 branch
BranchTrueFalseTotal
$opt->{'shout'} ? : 0 0 0
17 0 return 42;
18 },
19 2 }, __PACKAGE__);
20  
21 # A doctor row, so t/1311 can prove `punk doctor` finds a plugin's row
22 # without that plugin's command having been named first.
23 2 ▶Punk::Command->register_doctor('Fakecmd' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
24 2 return (1, 'the fixture is installed');
25 2 ▶}, __PACKAGE__) if Punk::Command->can('register_doctor');
Branch: 1 branch
BranchTrueFalseTotal
if "Punk::Command"->can("register_doctor") 2 0 2
26  
27 2 1;
« blib/lib/Punk/Test/WS/Conn.pm ↑ Summary blib/lib/Punk/Config.pm »