Skip to content
Browse files

Merge pull request #18 from pck/fix_prune_common_start

Fix pruning of common sequences at start.
  • Loading branch information...
2 parents 12df45e + 986cf91 commit 28fc343b704c4d7cfa6cc58ab799a0249c0da084 @halostatue committed Apr 20, 2013
Showing with 7 additions and 0 deletions.
  1. +1 −0 lib/diff/lcs/internals.rb
  2. +6 −0 spec/diff_spec.rb
View
1 lib/diff/lcs/internals.rb
@@ -49,6 +49,7 @@ def lcs(a, b)
(a[a_start] == b[b_start]))
vector[a_start] = b_start
a_start += 1
+ b_start += 1
end
b_start = a_start
View
6 spec/diff_spec.rb
@@ -31,6 +31,12 @@
change_diff(correct_diff).should == diff
end
+ it "should correctly diff 'xx' and 'xaxb'" do
+ left = 'xx'
+ right = 'xaxb'
+ Diff::LCS.patch(left, Diff::LCS.diff(left, right)).should == right
+ end
+
it "should return an empty diff with (hello, hello)" do
Diff::LCS.diff(hello, hello).should == []
end

0 comments on commit 28fc343

Please sign in to comment.
Something went wrong with that request. Please try again.