Branch Coverage

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


line true false branch
50 736 0 if (@_ % 2 == 0) { }
0 0 elsif (@_ == 1) { }
59 736 0 if (-f $args{'file'}) { }
64 4 732 if ($args{'include_paths'})
66 4 0 if (ref $args{'include_paths'} eq 'ARRAY') { }
72 6 1 if length $_
74 8 728 if $args{'debug'}
105 98 982 unless ($self->{'_list_index_map'})
140 42 3688 if (@args and $self->{'debug'})
167 24 398 unless (defined $self->{'_attached_files'})
170 420 2 if (defined $arg) { }
243 627 412 unless (defined $self->{'_doc_language_code'})
248 602 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 679 unless open my $fh, "<:encoding(UTF-8)", $file
328 2250 17778 if ($in_meta)
330 637 1613 if ($line =~ /^\s*$/s) { }
848 765 elsif ($line =~ /^\#([A-Za-z0-9_-]+)(\s+(.+))?$/s) { }
86 679 elsif ($lastdirective) { }
341 24 824 unless (length $dir)
344 17 831 if (exists $directives{$dir})
347 789 59 if (defined $material) { }
363 1571 18457 if ($in_meta) { }
19 18438 elsif ($options{'directives_only'}) { }
392 4 656 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 641 158 unless (defined $self->{'raw_header'})
489 17 626 unless (defined $self->{'raw_body'})
497 2 0 unless (defined $self->{'directives_array'})
513 12651 6293 if (my $el = $self->_construct_element($l))
521 64 13219 if ($el->type eq "versep")
533 45 13238 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 1448 11835 if ($el->type eq 'li' or $el->type eq 'dd') { }
3035 8800 elsif ($el->type eq 'regular') { }
2154 6646 elsif ($el->type ne 'null') { }
555 1106 342 if ($self->_list_pile_count) { }
320 22 elsif ($self->_list_element_can_be_first($el)) { }
557 212 894 if (_indentation_kinda_major($el, $self->_list_pile_last_element)) { }
563 894 0 if ($self->_list_pile_count) { }
564 780 114 if ($self->_list_element_is_same_kind_as_in_list($el) and $self->_list_element_is_a_progression($el)) { }
598 185 2850 if ($self->_list_pile_count)
618 575 17245 if ($el->type eq 'footnote' or $el->type eq 'secondary_footnote') { }
905 16340 elsif (my $fn_indent = $self->_current_footnote_indent) { }
622 661 244 if ($el->type eq 'null') { }
98 146 elsif ($el->can_be_regular and $el->indentation and _kinda_equal($el->indentation, $fn_indent)) { }
644 173 16974 if ($el->can_be_regular) { }
658 2466 15027 if ($el->type eq 'startblock') { }
2465 12562 elsif ($el->type eq 'stopblock') { }
31 21955 elsif (@pile and $el->should_close_blocks) { }
661 0 2466 unless $el->block
665 25 2440 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 632 386 unless (defined $self->{'_parsed_document'})
712 1018 0 if (defined wantarray) { }
729 1 1950 unless $arg
730 1950 0 if ($arg =~ /(\{[1-9][0-9]*\}|\[[1-9][0-9]*\])/) { }
736 1674 276 if (exists $self->_raw_footnotes->{$arg}) { }
753 2560 53 if (@_)
761 2560 17245 if (@_)
771 0 19756 unless defined $l
776 420 19336 if ($l =~ /\A (\s*) (\#([A-Za-z][A-Za-z0-9-]+)\x{20}*) (.*) \z /sx)
798 8027 11729 if ($l =~ /^[\n\t ]*$/s)
803 399 11330 if ($l =~ /^(<($blockre)>\s*)$/s)
809 45 11285 if ($l =~ /^((\<\<\<|\>\>\>)\s*)$/s)
816 15 11270 if ($l =~ m(^( ( \< (/?) \[ ([a-zA-Z-]+) \] \> ) \s* )$)sx)
828 7 8 $close ? :
835 75 11195 if ($l =~ /^(\{\{\{)\s*$/s)
842 75 11120 if ($l =~ /^(\}\}\})\s*$/s)
849 374 10746 if ($l =~ m[^(\s*)$]s)
856 795 9951 if ($l =~ /^((\*{1,5}) )(.+)$/s)
862 185 9766 if ($l =~ /^(\> )(.*)/s)
868 35 9731 if ($l =~ /^(\>)$/s)
874 547 9184 if ($l =~ /^(\x{20}+)/s and $l =~ /\|/)
880 30 9154 if ($l =~ /^\|+(\x{20}+|\+)/s)
885 93 9061 if ($l =~ /^(\;)(\x{20}+(.*))?$/s)
888 12 81 unless (defined $element{'string'})
894 469 8592 if ($l =~ /^((\[([1-9][0-9]*)\])\x{20}+)(.+)$/s)
903 143 8449 if ($l =~ /^((\{([1-9][0-9]*)\})\x{20}+)(.+)$/s)
912 44 8405 if ($l =~ /^((\x{20}{6,})((\*\x{20}?){5})\s*)$/s)
918 153 8252 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 8230 22 unless ($opts{'nolist'})
937 483 7747 if ($l =~ /^((\x{20}+)\-\x{20}+)(.*)/s)
946 1064 6683 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 1064 0 if (my $list_index = $self->_get_start_list_index($prefix))
972 65 6640 if ($l =~ /^(\x{20}{20,})([^ ].+)$/s)
979 488 6152 if ($l =~ /^(\x{20}{6,})([^ ].+)$/s)
986 966 5186 if ($l =~ /^(\x{20}{2,})([^ ].+)$/s)
1003 392 672 if ($list_type =~ /\A[0-9]+\z/) { }
166 506 elsif ($list_type =~ /\A[ixvl]+\z/) { }
79 427 elsif ($list_type =~ /\A[IXVL]+\z/) { }
274 153 elsif ($list_type =~ /\A[a-z]\z/) { }
153 0 elsif ($list_type =~ /\A[A-Z]\z/) { }
1022 1067 2 if (exists $map->{$prefix}) { }
1034 42 300 if $el->type eq "dd"
1035 0 300 unless $el->type eq "li"
1037 22 278 if ($el->indentation > 8) { }
1047 13971 19632 if (@_)
1057 22 0 if ($el->type eq 'regular') { }
1071 188 17804 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 2347 51704 if ($current and $current->type eq $block) { }
356 51348 elsif ($element->is_start_block($block)) { }
1091 320 2027 if ($element->is_stop_element($current)) { }
1100 6 2021 if ($current->type eq 'verse' and $element->type eq 'inlinecomment') { }
1121 4158 12663 if ($current and $current->can_append($element))
1133 0 7218 unless $open_close and $block
1135 2376 4842 if ($open_close eq 'open') { }
4842 0 elsif ($open_close eq 'close') { }
1145 7218 0 if ($indentation)
1156 131 1295 if ($el->attribute and $el->attribute_type)
1174 646 0 if (my $list_index = $el->start_list_index)
1214 2871 361 if ($one_indent and $two_indent)
1218 286 2946 if ($diff - $tolerance > 0) { }
767 2179 elsif ($diff + $tolerance < 0) { }
1237 894 894 if $block eq "li" or $block eq "dd"
1238 824 70 if ($block eq $find)
1249 575 0 if (defined $fn_num) { }
1250 0 575 if ($self->_raw_footnotes->{$fn_num})
1266 53 1932 if (@{$self->_current_footnote_stack;})
1268 0 53 unless $footnote
1307 646 0 if (my $list_index = $el->start_list_index)
1318 780 0 if (my $list_index = $el->start_list_index)
1355 0 824 if (not $last && $current) { }
317 507 elsif ($last > 0 and $current > 1) { }
1359 273 44 if ($current - $last == 1) { }