Changeset 21926 for lang/perl/String-Diff
- Timestamp:
- 10/23/08 11:15:03 (5 years ago)
- Location:
- lang/perl/String-Diff/trunk
- Files:
-
- 5 modified
-
lib/String/Diff.pm (modified) (4 diffs)
-
t/02_diff_fully.t (modified) (1 diff)
-
t/03_diff.t (modified) (1 diff)
-
t/04_diff_merge.t (modified) (1 diff)
-
t/05_diff_regexp.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/String-Diff/trunk/lib/String/Diff.pm
r21924 r21926 53 53 my @old_diff = (); 54 54 my @new_diff = (); 55 my $old_str = '';56 my $new_str = '';55 my $old_str; 56 my $new_str; 57 57 58 58 my @diff = sdiff( map{[ split //, $_ ]} $old, $new); … … 60 60 for my $line (@diff) { 61 61 if ($last_mode ne $line->[0]) { 62 push @old_diff, [$last_mode, $old_str] if $old_str;63 push @new_diff, [$last_mode, $new_str] if $new_str;62 push @old_diff, [$last_mode, $old_str] if defined $old_str; 63 push @new_diff, [$last_mode, $new_str] if defined $new_str; 64 64 65 65 # skip concut 66 push @old_diff, ['s', ''] unless $old_str;67 push @new_diff, ['s', ''] unless $new_str;68 69 $old_str = $new_str = '';66 push @old_diff, ['s', ''] unless defined $old_str; 67 push @new_diff, ['s', ''] unless defined $new_str; 68 69 $old_str = $new_str = undef; 70 70 } 71 71 … … 74 74 $last_mode = $line->[0]; 75 75 } 76 push @old_diff, [$last_mode, $old_str] if $old_str;77 push @new_diff, [$last_mode, $new_str] if $new_str;76 push @old_diff, [$last_mode, $old_str] if defined $old_str; 77 push @new_diff, [$last_mode, $new_str] if defined $new_str; 78 78 79 79 @old_diff = _fully_filter('-', @old_diff); … … 94 94 next; 95 95 } 96 push @filter, $last_line if $last_line->[1];96 push @filter, $last_line if length $last_line->[1]; 97 97 $last_line = $line; 98 98 } 99 push @filter, $last_line if $last_line->[1];99 push @filter, $last_line if length $last_line->[1]; 100 100 101 101 @filter; -
lang/perl/String-Diff/trunk/t/02_diff_fully.t
r21918 r21926 277 277 options: 278 278 linebreak: 1 279 280 === 281 --- data1 282 - 283 - ['u', '1'] 284 - ['-', '0'] 285 - 286 - ['u', '1'] 287 - ['+', '1'] 288 --- data2 289 old: 10 290 new: 11 291 -
lang/perl/String-Diff/trunk/t/03_diff.t
r21918 r21926 166 166 append_open: <ins> 167 167 append_close: </ins> 168 169 === 170 --- data1 171 - 1[0] 172 - 1{1} 173 --- data2 174 old: 10 175 new: 11 176 -
lang/perl/String-Diff/trunk/t/04_diff_merge.t
r21918 r21926 150 150 append_open: <ins> 151 151 append_close: </ins> 152 153 === 154 --- data1 155 1[0]{1} 156 --- data2 157 old: 10 158 new: 11 -
lang/perl/String-Diff/trunk/t/05_diff_regexp.t
r21918 r21926 125 125 options: 126 126 linebreak: 1 127 128 === 129 --- data1 130 1(?:0|1) 131 --- data2 132 old: 10 133 new: 11
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)