halostatue / diff-lcs

Generate difference sets between Ruby sequences.
http://halostatue.github.com/diff-lcs
Other
290 stars 57 forks source link

Diff::LCS.diff breaks under weird circumstances #1

Closed halostatue closed 7 years ago

halostatue commented 13 years ago

[#13817] Diff::LCS.diff breaks under weird circumstances

Date: 2007-09-10 04:45

Doing this causes a nasty bug:

seq1, seq2 = "aX", "bXaX"
Diff::LCS.patch(seq1, Diff::LCS.diff(seq1, seq2))
RuntimeError: The provided patchset does not appear to apply to the provided value as either source or destination
value.
        from /var/lib/gems/1.8/gems/diff-lcs-1.1.2/lib/diff/lcs.rb:1022:in `__diff_direction'
        from /var/lib/gems/1.8/gems/diff-lcs-1.1.2/lib/diff/lcs.rb:705:in `patch'
        from (irb):335

Do other people get the same error?

halostatue commented 12 years ago

This is related to issue #2.

halostatue commented 10 years ago

This is not, in fact, fixed.

  1) Diff::LCS Issues should not fail to provide a simple patchset (issue 1)
     Failure/Error: Diff::LCS.patch(s1, diff_s1_s2).should == s2
       expected: "bXaX"
            got: "" (using ==)
     # ./spec/issues_spec.rb:17:in `block (2 levels) in <top (required)>'
halostatue commented 10 years ago

It's still detecting this as an unpatch, so the intuition of simple patches is bollocks.

halostatue commented 7 years ago

Fixed, hopefully permanently, in #39.