packages feed

pretty-diff 0.4.0.0 → 0.4.0.1

raw patch · 4 files changed

+30/−12 lines, 4 files

Files

CHANGELOG.md view
@@ -1,3 +1,5 @@+# 0.4.0.1+- small fix for smaller diff context # 0.4.0.0 - `pretty/above/below` take `Text` instead of `Show a` allowing the user to decide how to turn stuff into a string. - `pretty` render multiline input nicely
pretty-diff.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: eed5c39a0385cbbf94a482ecf959f7f8b11c2359cb954cc2b8b87fb90d9b34e3+-- hash: 2de8bb4300f0e1ec9cb8d75f7c3bf5d103cc03bdff7e05ca1afee805857aaafa  name:           pretty-diff-version:        0.4.0.0+version:        0.4.0.1 synopsis:       Pretty printing a diff of two values. description:    Please see the README at <https://github.com/stoeffel/pretty-diff>. category:       Diffing
src/Pretty/Diff.hs view
@@ -135,7 +135,7 @@         Diff.getDiff           (Text.unpack x)           (Text.unpack y)-   in ( any (hasDiff First) diffs,+   in ( any hasDiff diffs,         withDiffLine First down diffs           & wrap wrapping           & filterEmptyLines@@ -163,7 +163,7 @@         Diff.getDiff           (Text.unpack x)           (Text.unpack y)-   in ( any (hasDiff Second) diffs,+   in ( any hasDiff diffs,         withDiffLine Second up diffs           & wrap wrapping           & filterEmptyLines@@ -248,15 +248,11 @@ takeRight :: Int -> [a] -> [a] takeRight i xs = reverse (take i (reverse xs)) -hasDiff :: Position -> Diff.Diff Char -> Bool-hasDiff pos d =+hasDiff :: Diff.Diff Char -> Bool+hasDiff d =   case d of-    Diff.First _ -> case pos of-      First -> True-      Second -> False-    Diff.Second x -> case pos of-      First -> False-      Second -> True+    Diff.First _ -> True+    Diff.Second x -> True     Diff.Both x _ -> False  separator :: Maybe Text -> Text
test/Main.hs view
@@ -262,6 +262,26 @@             "▲▲▲",             "JJJ",             "▲▲▲"+          ],+      testCase "addition in actual" $+        expectDiffToEqual+          ( Diff.pretty+              def {Diff.wrapping = Diff.Wrap 3, Diff.multilineContext = Diff.Surrounding 1 "..."}+              "a\nb\nc\nxd\ne\n"+              "a\nb\nc\nd\ne\n"+          )+          [ "...",+            "c",+            "▼",+            "xd",+            "e",+            "╷",+            "│",+            "╵",+            "...",+            "c",+            "d",+            "e"           ]     ]