From a341ac7ca261a73e37c21a7f034f5892ea7dcde4 Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Wed, 21 Mar 2012 02:27:56 -0400 Subject: Major investigation to Diff::LCS bugs. - Fixed some formatting and style issues. - Trailing spaces - Calling class methods using '.' instead of '::'. - Resolved Issue #2 by handling string[string.size, 1] properly (it returns "" not nil). - Added special case handling for Diff::LCS.patch so that it handles patches that are empty or contain no changes. - Adding temporary code to help determined the reason for the misidentification of patch direction. - Added a number of different specs to check for comparing the same value. - Added broken spec filtering. --- spec/issues_spec.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 spec/issues_spec.rb (limited to 'spec/issues_spec.rb') diff --git a/spec/issues_spec.rb b/spec/issues_spec.rb new file mode 100644 index 0000000..32a81e6 --- /dev/null +++ b/spec/issues_spec.rb @@ -0,0 +1,23 @@ +# -*- ruby encoding: utf-8 -*- + +require 'spec_helper' + +describe "Diff::LCS Issues" do + include Diff::LCS::SpecHelper::Matchers + + it "should not fail to provide a simple patchset (issue 1)", :broken => true do + s1, s2 = *%W(aX bXaX) + correct_forward_diff = [ + [ [ '+', 0, 'b' ], + [ '+', 1, 'X' ] ], + ] + + diff_s1_s2 = Diff::LCS.diff(s1, s2) + change_diff(correct_forward_diff).should == diff_s1_s2 + expect do + Diff::LCS.patch(s1, diff_s1_s2).should == s2 + end.to_not raise_error(RuntimeError, /provided patchset/) + end +end + +# vim: ft=ruby -- cgit v1.2.1