liufengyun / hashdiff

Hashdiff is a ruby library to to compute the smallest difference between two hashes
MIT License
559 stars 63 forks source link

"use_lcs: false" does not work as expected as per documentation #50

Closed taufek closed 5 years ago

taufek commented 5 years ago

In documentation it stated use_lcs: false should behave like below:

a = {x: [0, 1, 2]}
b = {x: [0, 2, 2, 3]}

diff = HashDiff.diff(a, b, :use_lcs => false)
diff.should == [["~", "x[1]", 1, 2], ["+", "x[3]", 3]]

But it got below instead for diff

[["-", "x[1]", 1], ["+", "x[1]", 2], ["+", "x[3]", 3]]
taufek commented 5 years ago

Found the issue. I was using hashdiff@0.3.5. Fixed the issue by upgraded to version 0.3.8.