summaryrefslogtreecommitdiff
path: root/spec/issues_spec.rb
diff options
context:
space:
mode:
authorAustin Ziegler <austin@surfeasy.com>2012-03-21 02:27:56 -0400
committerAustin Ziegler <austin@surfeasy.com>2012-03-21 02:36:24 -0400
commita341ac7ca261a73e37c21a7f034f5892ea7dcde4 (patch)
tree0c695c928eceb5752a554a9dd483d3e141af624d /spec/issues_spec.rb
parent86e4e1ba222cab4dddf13caa5c56925c9a6401dc (diff)
downloaddiff-lcs-a341ac7ca261a73e37c21a7f034f5892ea7dcde4.tar.gz
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.
Diffstat (limited to 'spec/issues_spec.rb')
-rw-r--r--spec/issues_spec.rb23
1 files changed, 23 insertions, 0 deletions
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