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   1887 use strict;
  4         5  
  4         98  
4 4     4   11 use warnings;
  4         5  
  4         486  
5              
6             sub normalize_maketext_string {
7 78     78 0 68 my ($filter) = @_;
8              
9 78         131 my $string_sr = $filter->get_string_sr();
10              
11             # This will handle previously altered characters like " in the aggregate results
12 78 100       54 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         187  
13 2         4 $filter->add_violation('Contains escape sequence');
14             }
15              
16 78 100       62 if ( ${$string_sr} =~ s/(?:\\([^NUuxX]))/[comment,escaped sequence “$1”]/g ) {
  78         202  
17 10         22 $filter->add_violation('Contains escape sequence');
18             }
19              
20 78         128 return $filter->return_value;
21             }
22              
23             1;
24              
25             __END__