blib/lib/DBIO/PostgreSQL/Diff/NoStatement.pm

filter: Statementstmt 100% 15 / 15 Branchbran 90.0% 9 / 10 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 97.0% 33 / 34 CC 7 SCAR 12.8
CC
7
Cov
96%
refuse_without_definition
5.0
throw
3.0
BEGIN
1.0
CRAP 3.6
« blib/lib/DBIO/PostgreSQL/InflateColumn/Vector.pm ↑ Summary blib/lib/DBIO/PostgreSQL/Vector/Op.pm »
1 package DBIO::PostgreSQL::Diff::NoStatement;
2 # ABSTRACT: An operation the diff has no statement for is refused, not written as a comment or a placeholder
3  
4 113 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 113 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 113 our $VERSION = '0.900007';
8  
9  
10  
11 13 ▶sub refuse_without_definition {
Subroutine refuse_without_definition: called CC=5 SCAR=16.1
Pod documented
12 13 my ($class, %object) = @_;
13 13 my ($kind, $name, $from) = @object{qw( kind name from )};
14  
15 die join "\n",
16 ( $object{in_database}
17 ? "refusing to diff: $kind $name is in the database and in the target, and the target model has no definition to compare it by or to write it from"
18 : "refusing to diff: $kind $name is in the target and not in the database, and the target model has no definition to create it from" ),
19 '',
20 "The diff writes every $kind as the text $from gives for it,",
21 'and compares it by that text.',
22 ( $object{null_when_gone}
23 ? ( 'The catalog gives none for an object that is gone by the time it is asked:',
24 'one that another session dropped while the model was read.' )
25 : () ),
26 'A model built by hand has none unless it is given one.',
27 ( defined $object{also} ? $object{also} : () ),
28 'No statement was generated.',
29 '',
30 13 ▶ ( $object{null_when_gone} ? 'Read the target model again and diff again.' : () ),
Branch: 4 branches
BranchTrueFalseTotal
$object{'in_database'} ? : 5 8 13
$object{'null_when_gone'} ? : 11 2 13
defined $object{'also'} ? : 3 10 13
$object{'null_when_gone'} ? : 11 2 13
31 "In a model built by hand, give the $kind its definition.",
32 '';
33 }
34  
35  
36 34 ▶sub throw {
Subroutine throw: called CC=3 SCAR=11.0
Pod documented
37 34 my ($class, $op, $object, $why) = @_;
38 34 my $action = $op->action;
39 34 ▶ $why //= 'the class knows no such action';
Condition100%2/2
$why //= "the class knows no such action"
l!l
2311
MC/DC100%1/1
$why //= "the class knows no such action"
$why
Truth table100%2/2
A
A= $why
Aresult
11
00
40  
41 34 ▶ die sprintf "%s: no statement for %s on %s -- %s\n",
Branch: 1 branch
BranchTrueFalseTotal
defined $action ? : 34 0 34
42 ref $op, ( defined $action ? "action '$action'" : 'an operation without an action' ),
43 $object, $why;
44 }
45  
46  
47 113 1;
48  
49 __END__
« blib/lib/DBIO/PostgreSQL/InflateColumn/Vector.pm ↑ Summary blib/lib/DBIO/PostgreSQL/Vector/Op.pm »