scripts/a8it

filter: Statementstmt 97.2% 71 / 73 Branchbran 84.6% 22 / 26 Conditioncond 66.6% 6 / 9 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 88.7% 110 / 124 CC 1 SCAR 0.0
CC
1
Cov
92%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Test/A8N.pm ↑ Summary
1 #!/usr/bin/env perl
2 18 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 18 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 18 ▶use lib qw( t/lib blib lib );
Subroutine BEGIN: called CC=1 SCAR=0.0
5 18 ▶use Test::A8N;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 18 ▶use Getopt::Long;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 18 ▶use Pod::Usage;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 18 ▶use YAML::Syck;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 18 our $config = {};
11 18 my $home = $ENV{HOME};
12 18 my $config_path;
13  
14 18 our @allowed_extensions;
15 18 our $verbose;
16 18 our $version = 0;
17 18 our $help = 0;
18 18 our $list = 0;
19 18 our $fixture_base;
20 18 our $file_root;
21 18 our $test_id;
22 18 our @tags = ();
23 18 ▶GetOptions(
Branch: 1 branch
BranchTrueFalseTotal
&GetOptions("version", \$main::version, "v|verbose+", \$main::verbose, "help", \$main::help, "list", \$main::list, "b|fixture_base=s", \$main::fixture_base, "r|file_root=s", \$main::file_root, "config=s", \$config_path, "tag=s", \@main::tags, "extension=s", \@main::allowed_extensions, "id=s", \$main::test_id) or usage() 18 0 18
24 'version' => \$version,
25 'v|verbose+' => \$verbose,
26 'help' => \$help,
27 'list' => \$list,
28 'b|fixture_base=s' => \$fixture_base,
29 'r|file_root=s' => \$file_root,
30 'config=s' => \$config_path,
31 'tag=s' => \@tags,
32 'extension=s' => \@allowed_extensions,
33 'id=s' => \$test_id,
34 ) or usage();
35 18 ▶usage() if $help;
Branch: 1 branch
BranchTrueFalseTotal
if $main::help 1 17 18
36 17 ▶version() if $version;
Branch: 1 branch
BranchTrueFalseTotal
if $main::version 1 16 17
37  
38 16 ▶if (defined($config_path) and !-f $config_path) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $config_path and not -f $config_path) 0 16 16
Condition66%2/3
defined $config_path and not -f $config_path
!ll&&!rl&&r
1420
MC/DC0%0/2
defined $config_path and not -f $config_path
defined $config_path not -f $config_path
Truth table66%2/3
A and not(B)
A= defined $config_pathB= not -f $config_path
ABresult
0X0
100
111
39 0 warn "Can't find specified config file \"$config_path\"\n";
40 0 usage();
41 }
42 16 ▶$config_path ||= glob("$home/.a8rc");
Subroutine BEGIN: called CC=1 SCAR=0.0
Condition66%2/3
$config_path ||= glob("$home/.a8rc")
l!l&&r!l&&!r
2140
MC/DC0%0/2
$config_path ||= glob("$home/.a8rc")
$config_path glob("$home/.a8rc")
Truth table66%2/3
A ||= B
A= $config_pathB= glob("$home/.a8rc")
ABresult
1X1
011
000
43 16 ▶if (defined($config_path) and -r $config_path) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $config_path and -r $config_path) 2 14 16
Condition66%2/3
defined $config_path and -r $config_path
!ll&&!rl&&r
0142
MC/DC50%1/2
defined $config_path and -r $config_path
defined $config_path -r $config_path
Truth table66%2/3
A and B
A= defined $config_pathB= -r $config_path
ABresult
0X0
100
111
44 2 $config = LoadFile($config_path);
45 }
46  
47 16 ▶if ($config->{fixture_root}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($main::config->{"fixture_root"}) 2 14 16
48 2 lib->import($config->{fixture_root});
49 }
50 16 @tags = split(/,/, join(',', @tags));
51 1 our @exclude_tags = map { $_ =~ /^!(.*)/ }
52 16 grep { $_ =~ /^!/ }
53 @tags;
54 16 our @include_tags = grep { $_ !~ /^!/ }
55 @tags;
56  
57 16 ▶$config->{allowed_extensions} = \@allowed_extensions if @allowed_extensions;
Branch: 1 branch
BranchTrueFalseTotal
if @main::allowed_extensions 0 16 16
58 16 ▶$config->{fixture_base} = $fixture_base if defined $fixture_base;
Branch: 1 branch
BranchTrueFalseTotal
if defined $main::fixture_base 0 16 16
59 16 ▶$config->{file_root} = $file_root if defined $file_root;
Branch: 1 branch
BranchTrueFalseTotal
if defined $main::file_root 14 2 16
60 16 ▶$config->{verbose} = $verbose if defined $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if defined $main::verbose 4 12 16
61 16 ▶$config->{filenames} = \@ARGV if @ARGV;
Branch: 1 branch
BranchTrueFalseTotal
if @ARGV 12 4 16
62 16 ▶$config->{testcase_id} = $test_id if defined $test_id;
Branch: 1 branch
BranchTrueFalseTotal
if defined $main::test_id 1 15 16
63 $config->{tags} = {
64 16 include => \@include_tags,
65 exclude => \@exclude_tags,
66 };
67  
68 16 my $a8n = Test::A8N->new({ config => $config });
69 16 ▶if ($list) {
Branch: 1 branch
BranchTrueFalseTotal
if ($main::list) 6 10 16
70 6 my @cases = map { @{ $_->filtered_cases($test_id) } }
71 6 @{ $a8n->files };
72 6 foreach my $case (@cases) {
73 9 print $case->filename . " => " . $case->id . "\n";
74 }
75 6 exit;
76 }
77 10 $a8n->run_tests();
78  
79 1 ▶sub usage {
Subroutine usage: called CC=1 SCAR=0.0
80 1 pod2usage();
81 }
82  
83 1 ▶sub version {
Subroutine version: called CC=1 SCAR=0.0
84 1 print "a8it version " . $Test::A8N::VERSION . "\n";
85 1 exit 2;
86 }
87  
88 __END__
« blib/lib/Test/A8N.pm ↑ Summary