Branch Coverage

blib/lib/Text/Amuse/Document.pm
Criterion Covered Total %
branch 255 288 88.5


line true false branch
50 731 0 if (@_ % 2 == 0) { }
0 0 elsif (@_ == 1) { }
59 731 0 if (-f $args{'file'}) { }
64 4 727 if ($args{'include_paths'})
66 4 0 if (ref $args{'include_paths'} eq 'ARRAY') { }
72 6 1 if length $_
74 4 727 if $args{'debug'}
105 96 979 unless ($self->{'_list_index_map'})
140 10 3686 if (@args and $self->{'debug'})
167 24 398 unless (defined $self->{'_attached_files'})
170 420 2 if (defined $arg) { }
243 622 407 unless (defined $self->{'_doc_language_code'})
248 597 25 if ($self->_language_mapping->{$lang})
258 64 0 unless (defined $self->{'_doc_language'})
269 60 101 @out ? :
275 32 2 unless $self->other_language_codes
276 2 32 @out ? :
281 0 62 unless $lang
283 61 1 if ($self->_language_mapping->{$lang}) { }
284 60 1 if ($lang ne $self->language_code)
285 5 55 unless $self->other_language_codes
11 49 unless (grep {$_ eq $lang;} @{[] unless $self->other_language_codes;})
313 0 674 unless open my $fh, "<:encoding(UTF-8)", $file
328 2234 17637 if ($in_meta)
330 632 1602 if ($line =~ /^\s*$/s) { }
842 760 elsif ($line =~ /^\#([A-Za-z0-9_-]+)(\s+(.+))?$/s) { }
86 674 elsif ($lastdirective) { }
341 24 818 unless (length $dir)
344 17 825 if (exists $directives{$dir})
347 783 59 if (defined $material) { }
363 1560 18311 if ($in_meta) { }
19 18292 elsif ($options{'directives_only'}) { }
392 4 651 if (my(@include_paths) = $self->include_paths)
397 11 27 if ($l =~ /^#include\s+(.+?)\s*$/)
398 2 9 if (my $lines = $self->_resolve_include($1, \@include_paths))
417 6 5 if (grep {/^\./;} @dirs, $file)
422 2 3 if (grep {m([/\\]);} @dirs, $file)
427 1 2 unless $file
436 2 0 if (-e $final and -T $final)
437 0 2 unless open my $fh, "<:encoding(UTF-8)", $final
452 2 0 if (@out) { }
469 636 158 unless (defined $self->{'raw_header'})
489 17 621 unless (defined $self->{'raw_body'})
497 2 0 unless (defined $self->{'directives_array'})
513 12532 6261 if (my $el = $self->_construct_element($l))
521 63 13096 if ($el->type eq "versep")
533 45 13114 if ($el->type eq "bidimarker")
535 0 45 unless my $dir = $dirs{$el->block}
536 15 30 if ($current_direction and $current_direction ne $dir) { }
542 6 24 if $current_direction
554 1438 11721 if ($el->type eq 'li' or $el->type eq 'dd') { }
3020 8701 elsif ($el->type eq 'regular') { }
2117 6584 elsif ($el->type ne 'null') { }
555 1101 337 if ($self->_list_pile_count) { }
315 22 elsif ($self->_list_element_can_be_first($el)) { }
557 208 893 if (_indentation_kinda_major($el, $self->_list_pile_last_element)) { }
563 893 0 if ($self->_list_pile_count) { }
564 779 114 if ($self->_list_element_is_same_kind_as_in_list($el) and $self->_list_element_is_a_progression($el)) { }
598 185 2835 if ($self->_list_pile_count)
618 556 17093 if ($el->type eq 'footnote' or $el->type eq 'secondary_footnote') { }
883 16210 elsif (my $fn_indent = $self->_current_footnote_indent) { }
622 644 239 if ($el->type eq 'null') { }
98 141 elsif ($el->can_be_regular and $el->indentation and _kinda_equal($el->indentation, $fn_indent)) { }
644 172 16823 if ($el->can_be_regular) { }
658 2442 14897 if ($el->type eq 'startblock') { }
2441 12456 elsif ($el->type eq 'stopblock') { }
31 21768 elsif (@pile and $el->should_close_blocks) { }
661 0 2442 unless $el->block
665 25 2416 unless ($exp and $exp->block eq $el->block)
668 0 25 if $exp
680 15 16 if ($block->block eq 'rtl' || $block->block eq 'ltr' and not $close_rtl{$el->type}) { }
709 627 381 unless (defined $self->{'_parsed_document'})
712 1008 0 if (defined wantarray) { }
729 1 1904 unless $arg
730 1904 0 if ($arg =~ /(\{[1-9][0-9]*\}|\[[1-9][0-9]*\])/) { }
736 1628 276 if (exists $self->_raw_footnotes->{$arg}) { }
753 2507 53 if (@_)
761 2507 17093 if (@_)
771 0 19600 unless defined $l
776 420 19180 if ($l =~ /\A (\s*) (\#([A-Za-z][A-Za-z0-9-]+)\x{20}*) (.*) \z /sx)
798 7972 11628 if ($l =~ /^[\n\t ]*$/s)
803 394 11234 if ($l =~ /^(<($blockre)>\s*)$/s)
809 45 11189 if ($l =~ /^((\<\<\<|\>\>\>)\s*)$/s)
816 15 11174 if ($l =~ m(^( ( \< (/?) \[ ([a-zA-Z-]+) \] \> ) \s* )$)sx)
828 7 8 $close ? :
835 75 11099 if ($l =~ /^(\{\{\{)\s*$/s)
842 75 11024 if ($l =~ /^(\}\}\})\s*$/s)
849 369 10655 if ($l =~ m[^(\s*)$]s)
856 787 9868 if ($l =~ /^((\*{1,5}) )(.+)$/s)
862 182 9686 if ($l =~ /^(\> )(.*)/s)
868 35 9651 if ($l =~ /^(\>)$/s)
874 544 9107 if ($l =~ /^(\x{20}+)/s and $l =~ /\|/)
880 30 9077 if ($l =~ /^\|+(\x{20}+|\+)/s)
885 92 8985 if ($l =~ /^(\;)(\x{20}+(.*))?$/s)
888 12 80 unless (defined $element{'string'})
894 456 8529 if ($l =~ /^((\[([1-9][0-9]*)\])\x{20}+)(.+)$/s)
903 137 8392 if ($l =~ /^((\{([1-9][0-9]*)\})\x{20}+)(.+)$/s)
912 44 8348 if ($l =~ /^((\x{20}{6,})((\*\x{20}?){5})\s*)$/s)
918 150 8198 if ($l =~ /\A (\x{20}+) # 1. initial space and indentation (.+) # 2. desc title (\x{20}+) # 3. space (\:\:) # 4 . separator ((\x{20}?)(.*)) # 5 6. space 7. text \z /sx)
936 8176 22 unless ($opts{'nolist'})
937 481 7695 if ($l =~ /^((\x{20}+)\-\x{20}+)(.*)/s)
946 1059 6636 if ($l =~ /^((\x{20}+) # leading space and type $1 ( # the type $2 [0-9]+ | [a-zA-Z] | [ixvl]+ | [IXVL]+ ) \. # single dot \x{20}+) # space (.*) # the string itself $4 /sx)
960 1059 0 if (my $list_index = $self->_get_start_list_index($prefix))
972 65 6593 if ($l =~ /^(\x{20}{20,})([^ ].+)$/s)
979 487 6106 if ($l =~ /^(\x{20}{6,})([^ ].+)$/s)
986 966 5140 if ($l =~ /^(\x{20}{2,})([^ ].+)$/s)
1003 390 669 if ($list_type =~ /\A[0-9]+\z/) { }
166 503 elsif ($list_type =~ /\A[ixvl]+\z/) { }
77 426 elsif ($list_type =~ /\A[IXVL]+\z/) { }
273 153 elsif ($list_type =~ /\A[a-z]\z/) { }
153 0 elsif ($list_type =~ /\A[A-Z]\z/) { }
1022 1062 2 if (exists $map->{$prefix}) { }
1034 40 297 if $el->type eq "dd"
1035 0 297 unless $el->type eq "li"
1037 22 275 if ($el->indentation > 8) { }
1047 13842 19476 if (@_)
1057 22 0 if ($el->type eq 'regular') { }
1071 188 17662 if ($current and $current->type eq 'null' || $current->type eq 'startblock' and $current->anchors)
1075 108 216 if ($element->type eq "null" and $element->anchors and $current->type ne "null" and $current->type ne "example")
1090 2336 51261 if ($current and $current->type eq $block) { }
352 50909 elsif ($element->is_start_block($block)) { }
1091 316 2020 if ($element->is_stop_element($current)) { }
1100 6 2014 if ($current->type eq 'verse' and $element->type eq 'inlinecomment') { }
1121 4133 12547 if ($current and $current->can_append($element))
1133 0 7148 unless $open_close and $block
1135 2353 4795 if ($open_close eq 'open') { }
4795 0 elsif ($open_close eq 'close') { }
1145 7148 0 if ($indentation)
1156 128 1288 if ($el->attribute and $el->attribute_type)
1174 637 0 if (my $list_index = $el->start_list_index)
1214 2865 347 if ($one_indent and $two_indent)
1218 282 2930 if ($diff - $tolerance > 0) { }
753 2177 elsif ($diff + $tolerance < 0) { }
1237 893 893 if $block eq "li" or $block eq "dd"
1238 823 70 if ($block eq $find)
1249 556 0 if (defined $fn_num) { }
1250 0 556 if ($self->_raw_footnotes->{$fn_num})
1266 53 1898 if (@{$self->_current_footnote_stack;})
1268 0 53 unless $footnote
1307 637 0 if (my $list_index = $el->start_list_index)
1318 779 0 if (my $list_index = $el->start_list_index)
1355 0 823 if (not $last && $current) { }
317 506 elsif ($last > 0 and $current > 1) { }
1359 273 44 if ($current - $last == 1) { }