filediff 1.0.0.3 → 1.0.0.4
raw patch · 3 files changed
+23/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Tests/test-filediff.hs +17/−1
- filediff.cabal +1/−1
- src/Filediff.hs +5/−1
Tests/test-filediff.hs view
@@ -616,8 +616,18 @@ F.numAddedLines diff @?= 1 + 3 F.numDeletedLines diff @?= 1 + 2 --- tests+testSameListConcatenated :: Assertion+testSameListConcatenated = do+ let diff = F.diffLists "abc" "abcabc" + diff @?= F.ListDiff {F.dels = [], F.adds = [(3,'a'),(4,'b'),(5,'c')]}++testSameListConcatenatedWithIntermediate :: Assertion+testSameListConcatenatedWithIntermediate = do+ let diff = F.diffLists "abc" "abc*abc"++ diff @?= F.ListDiff {F.dels = [], F.adds = [(3, '*'), (4,'a'),(5,'b'),(6,'c')]}+ tests :: TestTree tests = testGroup "unit tests" [ -- diffing@@ -735,6 +745,12 @@ , testCase "Testing diff statistics" (runTest testDiffStats)+ , testCase+ "Testing same list concatenated with itself (case 1)"+ testSameListConcatenated+ , testCase+ "Testing same list concatenated with itself (case 2)"+ testSameListConcatenatedWithIntermediate ] main :: IO ()
filediff.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: filediff-version: 1.0.0.3+version: 1.0.0.4 synopsis: Diffing and patching module description: `filediff` is a Haskell library for creating diffs, and applying diffs to files and directories. homepage: https://github.com/bgwines/filediff
src/Filediff.hs view
@@ -273,8 +273,12 @@ commonPrefix :: [a] commonPrefix = getCommonPrefix xs ys + -- drop (length commonPrefix) to prevent the "abc" vs. "abc*abc" case commonSuffix :: [a]- commonSuffix = reverse (getCommonPrefix (reverse xs) (reverse ys))+ commonSuffix = reverse+ (getCommonPrefix+ (reverse (drop (length commonPrefix) xs))+ (reverse (drop (length commonPrefix) ys))) getCommonPrefix :: [a] -> [a] -> [a] getCommonPrefix as bs = map fst . takeWhile (uncurry (==)) $ zip as bs