Branch Coverage

blib/lib/DBIx/TempDB.pm
Criterion Covered Total %
branch 63 110 57.2


line true false branch
25 0 2 if $_[0]{'created'}
32 0 2 unless eval { do { $self->_create_database($name) } }
36 0 2 if $ENV{'DBIX_TEMP_DB_KEEP_DATABASE'} and not $ENV{'DBIX_TEMP_DB_SILENT'}
37 0 2 if $self->{'drop_from_child'} == 1
38 0 2 if $self->{'drop_from_child'} == 2
52 1 6 if (not ref $self and $url) { }
53 1 0 unless ref $url and $url->isa('URI::_db')
54 0 1 unless ($url->has_recognized_engine)
60 0 6 unless $self->{'database_name'}
69 0 1 if $self->url->canonical_engine eq 'sqlite'
77 1 0 unless ('File::Spec'->file_name_is_absolute($path))
82 0 1 unless open my $SQL, '<', $path
85 0 1 unless defined $ret
93 0 9 unless ($url->has_recognized_engine)
99 0 9 unless ($self->can($dsn_for))
110 0 9 if $ENV{'DBIX_TEMP_DB_KEEP_DATABASE'}
112 2 7 if $self->{'auto_create'} // 1
120 0 9 if $self->{'DROP_PIPE'}
121 0 9 if $ENV{'DBIX_TEMP_DB_KEEP_DATABASE'}
122 0 9 if $self->{'double_forked'}
123 2 7 if $self->{'created'}
130 1 1 if (ref $self->{'drop_database_command'} eq 'CODE') { }
1 0 elsif ($self->url->canonical_engine eq 'sqlite') { }
134 0 1 unless unlink $self->{'database_name'}
142 0 2 unless (eval { do { if (ref $self->{'drop_database_command'} eq 'CODE') { $self->{'drop_database_command'}->($self, $self->{'database_name'}); } elsif ($self->url->canonical_engine eq 'sqlite') { die $! unless unlink $self->{'database_name'}; } else { my $sql = $self->{'drop_database_command'}; $sql =~ s/\%d/$self->{'database_name'}/g; 'DBI'->connect($self->_schema_dsn)->do($sql); } ; 1 } })
150 1 1 if (ref $self->{'create_database_command'} eq 'CODE') { }
1 0 elsif ($self->url->canonical_engine eq 'sqlite') { }
156 0 1 unless 'IO::File'->new->open($name, 194)
173 0 2 if (my $service = delete $opt{'service'})
228 2 2 $n > 0 ? :
5 0 $1 eq 'X' ? :
4 5 $1 eq 'U' ? :
2 9 $1 eq 'T' ? :
2 11 $1 eq 'P' ? :
4 13 $1 eq 'H' ? :
4 17 $1 eq 'i' ? :
237 0 7 if (63 < length $name and not $self->{'keep_too_long_database_name'})
240 0 0 unless $self->{'template'} =~ s/\%T//g or $self->{'template'} =~ s/\%H//g or $self->{'template'} =~ s/\%X//g
243 0 0 if not $ENV{'HARNESS_ACTIVE'} or $ENV{'HARNESS_VERBOSE'}
251 6 1 if $self->url->canonical_engine ne 'sqlite'
263 0 0 unless pipe my $READ, $self->{'DROP_PIPE'}
264 0 0 unless defined(my $pid = fork)
267 0 0 if $pid
275 0 0 if fileno $READ == $_
292 0 0 unless defined(my $pid = fork)
294 0 0 if ($pid)
310 0 0 unless POSIX::setsid() != -1
312 0 0 if fork // confess("Couldn't fork: $!")
326 5 72 if ($sql =~ /^$delimiter/x) { }
1 71 elsif ($sql =~ /^delimiter\s+(\S+)\s*(?:\n|\z)/ip) { }
55 16 elsif ($sql =~ /^(\s+)/s or $sql =~ /^(\w+)/) { }
5 11 elsif ($sql =~ /^--.*(?:\n|\z)/p or $sql =~ /^\#.*(?:\n|\z)/p or $sql =~ m[^/\*(?:[^\*]|\*[^/])*(?:\*/|\*\z|\z)]p or $sql =~ /^'(?:[^'\\]*|\\(?:.|\n)|'')*(?:'|\z)/p or $sql =~ /^"(?:[^"\\]*|\\(?:.|\n)|"")*(?:"|\z)/p or $sql =~ /^`(?:[^`]*|``)*(?:`|\z)/p) { }
357 6 71 if ($new) { }
358 6 0 unless $last =~ /^\s*$/s
366 1 1 unless $last =~ /^\s*$/s