File Coverage

blib/lib/Locale/Maketext/Utils/Phrase/Norm/Escapes.pm
Criterion Covered Total %
statement 15 15 100.0
branch 4 4 100.0
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 22 23 95.6


line stmt bran cond sub pod time code
1             package Locale::Maketext::Utils::Phrase::Norm::Escapes;
2              
3 4     4   4797 use strict;
  4         10  
  4         174  
4 4     4   24 use warnings;
  4         7  
  4         984  
5              
6             sub normalize_maketext_string {
7 78     78 0 137 my ($filter) = @_;
8              
9 78         225 my $string_sr = $filter->get_string_sr();
10              
11             # This will handle previously altered characters like " in the aggregate results
12 78 100       108 if ( ${$string_sr} =~ s/(?:\\\[(.*?)\])/[comment,escaped sequence “~[$1~]”]/g ) { # TODO: make the \[.*?\] regex/logic smarter since it will not work with ~[ but why would we do that right :) - may need to wait for phrase-as-class obj
  78         361  
13 2         9 $filter->add_violation('Contains escape sequence');
14             }
15              
16 78 100       120 if ( ${$string_sr} =~ s/(?:\\([^NUuxX]))/[comment,escaped sequence “$1”]/g ) {
  78         338  
17 10         37 $filter->add_violation('Contains escape sequence');
18             }
19              
20 78         350 return $filter->return_value;
21             }
22              
23             1;
24              
25             __END__