Skip to content

Commit e0b243f

Browse files
committed
Some extra characters removed from regexp for Perl version <= 5.6.
This characters actually is not punctuation. Tests were updated correspondingly.
1 parent 9dc957c commit e0b243f

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

lib/Text/WordDiff.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $VERSION = '0.08';
1111
# _Mastering Regular Expressions_, p. 132.
1212
my $BEGIN_WORD = $] >= 5.006
1313
? qr/(?:(?<!\p{IsWord})(?=\p{IsWord})|(?<!\p{IsPunct})(?=\p{IsPunct})|(?<!\p{IsCntrl})(?=\p{IsCntrl}))/msx
14-
: qr/(?<!\w)(?=\w)|(?<![\]\[!"#$%&'()*+,\.\/:;<=>?@\^_`{|}~-])(?=[\]\[!"#$%&'()*+,\.\/:;<=>?@\^_`{|}~-])|(?<![\n\r\t])(?=[\n\r\v])/msx;;
14+
: qr/(?:(?<!\w)(?=\w)|(?<![\]\[!"%&'()*,\.\/:;?\{}\-@])(?=[\]\[!"%&'()*,\.\/:;?\{}\-@])|(?<![\n\r\t])(?=[\n\r\t]))/msx;
1515

1616
my %styles = (
1717
ANSIColor => undef,

t/ansicolor.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ my $file_diff = 'This is a ' . BOLD . RED . STRIKETHROUGH . "tst;"
5454
. "actual diff, the results would\n"
5555
. 'have been output to ' . BOLD . RED . STRIKETHROUGH . "HTML"
5656
. RESET . BOLD . GREEN . UNDERLINE . "the terminal" . RESET . ".\n\n"
57-
. 'Some string with funny ' . BOLD . RED . STRIKETHROUGH . '$'
58-
. RESET . BOLD . GREEN . UNDERLINE . '@' . RESET . "\n"
57+
. 'Some string with ' . BOLD . RED . STRIKETHROUGH . 'funny $'
58+
. RESET . BOLD . GREEN . UNDERLINE . 'funny @' . RESET . "\n"
5959
. 'chars in the end' . BOLD . RED . STRIKETHROUGH . '*'
6060
. RESET . BOLD . GREEN . UNDERLINE . '?' . RESET . "\n";
6161

t/html.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ my $file_diff = qq{<div class="file">$header<span class="hunk">This is a </span>
5555
. qq{actual diff, the results would\n}
5656
. qq{have been output to </span><span class="hunk"><del>HTML</del>}
5757
. qq{<ins>the terminal</ins></span>}
58-
. qq{<span class="hunk">.\n\nSome string with funny </span>}
59-
. qq{<span class="hunk"><del>\$</del><ins>\@</ins></span>}
58+
. qq{<span class="hunk">.\n\nSome string with </span>}
59+
. qq{<span class="hunk"><del>funny \$</del><ins>funny \@</ins></span>}
6060
. qq{<span class="hunk">\nchars in the end</span>}
6161
. qq{<span class="hunk"><del>*</del><ins>?</ins></span>}
6262
. qq{<span class="hunk">\n</span></div>};

t/htmltwolines.t

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ my $file_diff = qq{<div class="file">$header1}
5656
. qq{test. Had </span><span class="hunk"><del>it </del></span><span class="hunk">been an\n}
5757
. qq{actual diff, the results would\n}
5858
. qq{have been output to </span><span class="hunk"><del>HTML</del></span>}
59-
. qq{<span class="hunk">.\n\nSome string with funny </span>}
60-
. qq{<span class="hunk"><del>\$</del></span>}
59+
. qq{<span class="hunk">.\n\nSome string with </span>}
60+
. qq{<span class="hunk"><del>funny \$</del></span>}
6161
. qq{<span class="hunk">\nchars in the end</span>}
6262
. qq{<span class="hunk"><del>*</del></span><span class="hunk">\n</span></div>\n}
6363
. qq{<div class="file">$header2}
@@ -67,8 +67,8 @@ my $file_diff = qq{<div class="file">$header1}
6767
. qq{test. Had </span><span class="hunk"><ins>this </ins></span><span class="hunk">been an\n}
6868
. qq{actual diff, the results would\n}
6969
. qq{have been output to </span><span class="hunk"><ins>the terminal</ins></span>}
70-
. qq{<span class="hunk">.\n\nSome string with funny </span>}
71-
. qq{<span class="hunk"><ins>\@</ins></span>}
70+
. qq{<span class="hunk">.\n\nSome string with </span>}
71+
. qq{<span class="hunk"><ins>funny \@</ins></span>}
7272
. qq{<span class="hunk">\nchars in the end</span>}
7373
. qq{<span class="hunk"><ins>?</ins></span><span class="hunk">\n</span></div>\n};
7474

0 commit comments

Comments
 (0)