Branch Coverage

blib/lib/GnuPG.pm
Criterion Covered Total %
branch 157 272 57.7


line true false branch
69 34 0 if (/ULTIMATE/)
70 0 0 if (/FULLY/)
71 0 0 if (/MARGINAL/)
72 0 0 if (/NEVER/)
80 405 27 if $_[0]
86 405 27 if $_[0]
92 405 27 if $_[0]
101 27 0 unless $self->{'trace'}
106 27 0 if $self->{'homedir'}
107 0 27 if $self->{'options'}
125 0 378 if $self->{'trace'}
128 0 378 unless close $self->{'status_fd'}
132 0 378 if $self->{'trace'}
135 0 378 unless close $self->{'command_fd'}
137 0 378 unless waitpid $self->{'gnupg_pid'}, 0
153 0 0 if ($self->{'gnupg_pid'} and kill 0, $self->{'gnupg_pid'})
172 0 1745 if ($self->{'next_status'})
178 0 1745 if $self->{'trace'}
183 0 1745 unless ($line)
184 0 0 if $self->{'trace'}
188 0 1745 if $self->{'trace'}
191 0 1745 unless $cmd
192 0 1745 if $self->{'trace'}
193 1464 281 wantarray ? :
205 0 405 unless pipe $fd, $wfd
210 0 405 unless pipe $crfd, $cwfd
216 0 405 unless fcntl $fd, 2, 0
218 0 405 unless fcntl $wfd, 2, 0
220 0 405 unless fcntl $crfd, 2, 0
222 0 405 unless fcntl $cwfd, 2, 0
226 0 405 unless defined $pid
227 378 27 if ($pid) { }
241 27 0 unless ($self->{'trace'})
242 0 27 unless open STDERR, '> /dev/null'
247 5 22 if (ref $self->{'input'} and defined fileno $self->{'input'}) { }
0 22 elsif ($self->{'input'} and -t STDIN) { }
16 6 elsif ($self->{'input'}) { }
249 0 5 unless open STDIN, '<&' . fileno($self->{'input'})
252 0 0 unless open STDIN, $self->{'input'}
258 5 22 if (ref $self->{'output'} and defined fileno $self->{'output'}) { }
0 22 elsif ($self->{'output'} and -t STDOUT) { }
15 7 elsif ($self->{'output'}) { }
260 0 5 unless open STDOUT, '>&' . fileno($self->{'output'})
263 0 0 unless open STDOUT, '>' . $self->{'output'}
279 27 14155695 if $f == fileno $self->{'status_fd'}
280 27 14155668 if $f == fileno $self->{'command_fd'}
285 0 27 if $self->{'trace'}
287 0 0 unless exec @$cmdline
302 80 346 unless (defined $cmd and $cmd =~ /^GET_/)
303 0 80 unless $optional
309 0 346 unless ($arg eq $key)
310 0 0 unless $optional
315 0 346 if $self->{'trace'}
320 0 346 unless (defined $cmd and $cmd =~ /^GOT_IT/)
332 113 55 if $cmd =~ /USERID_HINT/
333 0 168 if ($cmd =~ /GOOD_PASSPHRASE/)
337 0 168 unless $cmd =~ /NEED_PASSPHRASE/
340 0 168 unless ($passwd)
342 0 0 unless $cmd eq 'MISSING_PASSPHRASE'
354 46 0 if ($args{'homedir'})
356 0 46 unless -d $args{'homedir'} and -x _
359 0 46 if ($args{'options'})
361 0 0 unless -r $args{'options'}
364 0 46 if ($args{'gnupg_path'}) { }
366 0 0 unless -x $args{'gnupg_path'}
370 0 46 unless $path
374 0 46 $args{'trace'} ? :
382 0 14 if ($self->{'gnupg_pid'} and kill 0, $self->{'gnupg_pid'})
397 0 28 if $size < 768
398 0 28 if $size > 2048
406 0 28 unless $name
407 0 28 unless $name =~ /^\s*[^0-9\<\(\[\]\)\>][^\<\(\[\]\)\>]+$/
411 0 28 if ($email) { }
412 0 0 unless $email =~ /^\s* # Whitespace are okay [a-zA-Z0-9_-] # Doesn't start with a dot [a-zA-Z0-9_.-]* \@ # Contains at most one at [a-zA-Z0-9_.-]+ [a-zA-Z0-9_-] # Doesn't end in a dot /x and not $email =~ /\.\./
426 0 28 if ($comment) { }
427 0 0 if $comment =~ /[()]/
466 25 53 if (ref $args{'keys'}) { }
476 24 51 ref $args{'keys'} ? :
483 75 26 unless $cmd =~ /IMPORTED/
488 0 75 unless $cmd =~ /IMPORT_OK/
500 69 0 if $args{'armor'}
505 24 45 if ($args{'keys'})
507 0 24 ref $args{'keys'} ? :
510 22 47 if ($args{'secret'}) { }
0 47 elsif ($args{'all'}) { }
529 0 17 unless $args{'recipient'} or $args{'symmetric'}
531 2 102 ref $args{'recipient'} eq 'ARRAY' ? :
539 34 70 if $args{'sign'}
541 0 34 if $args{'sign'} and $args{'symmetric'}
545 104 0 if $args{'armor'}
547 0 104 if defined $args{'local-user'}
551 17 87 if ($args{'symmetric'}) { }
562 48 48 if ($args{'sign'} or $args{'symmetric'})
564 32 16 if ($args{'sign'})
566 0 32 unless $cmd =~ /GOOD_PASSPHRASE/
575 88 8 unless $args{'tie_mode'}
584 33 0 if $args{'armor'}
586 0 33 if defined $args{'local-user'}
590 10 23 if ($args{'clearsign'}) { }
11 12 elsif ($args{'detach-sign'}) { }
605 0 30 unless $cmd =~ /GOOD_PASSPHRASE/
608 30 0 unless $args{'tie_mode'}
622 21 13 unless $cmd
625 0 34 if $cmd =~ /RSA_OR_IDEA/
629 0 34 if $cmd =~ /IMPORTED/
632 0 34 if $cmd =~ /IMPORT_OK/
635 0 34 if $cmd =~ /IMPORT_RES/
638 0 34 if $cmd =~ /BADSIG/
641 0 34 if ($cmd =~ /ERRSIG/)
645 0 0 if ($rc == 9)
653 0 34 unless $cmd =~ /SIG_ID/
658 0 34 unless $cmd =~ /GOODSIG/
664 0 34 if ($cmd =~ /POLICY_URL/)
669 0 34 unless $cmd =~ /VALIDSIG/
674 0 34 unless $cmd =~ /TRUST/
692 0 24 unless $args{'signature'}
694 8 16 if ($args{'file'}) { }
696 0 8 unless -f $args{'signature'}
698 0 8 ref $args{'file'} ? :
726 57 6 unless $args{'tie_mode'}
735 51 12 unless ($args{'symmetric'})
737 0 51 unless $cmd =~ /ENC_TO/
744 0 63 if $cmd =~ /BAD_PASSPHRASE/
749 51 12 if (not $args{'symmetric'}) { }
750 0 51 unless $cmd =~ /GOOD_PASSPHRASE/
753 45 6 unless $args{'tie_mode'}
756 12 0 if $cmd =~ /BEGIN_DECRYPTION/
758 12 0 if $cmd =~ /DECRYPTION_INFO/
760 0 12 unless $cmd =~ /PLAINTEXT/
763 57 6 unless $args{'tie_mode'}
765 45 18 $sig ? :
776 51 0 if ($cmd =~ /BEGIN_DECRYPTION/)
783 13 153 if ($cmd =~ /SIG_ID/)
787 166 0 if defined $cmd
791 0 51 unless $cmd =~ /DECRYPTION_OKAY/
794 13 38 $sig ? :