packages feed

tasty-checklist 1.0.4.1 → 1.0.5.0

raw patch · 3 files changed

+27/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for tasty-checklist +## 1.0.5.0 -- 2023-01-07++  * Enhanced display of multi-line differences to make whitespace more visible.+ ## 1.0.4.1 -- 2022-12-26    * Bump upper bound of doctest to enable GHC 9.4 support.
src/Test/Tasty/Checklist.hs view
@@ -379,15 +379,21 @@       db b = "|        > " <> b       de m e = "|" <> m <> "expect> " <> e       da m a = "|" <> m <> "actual> " <> a-      el = T.lines expected-      al = T.lines actual+      el = visible <$> T.lines expected+      al = visible <$> T.lines actual+      visible = T.replace " " "␠"+                . T.replace "\n" "␤"+                . T.replace "\t" "␉"+                . T.replace "\012" "␍"       addnum :: Int -> T.Text -> T.Text       addnum n l = let nt = T.pack (show n)                        nl = T.length nt                    in T.take (4 - nl) "    " <> nt <> l+      ll = T.pack . show . length+      tl = T.pack . show . T.length       banner = "MISMATCH between "-               <> T.pack (show $ length el) <> " expected and "-               <> T.pack (show $ length al) <> " actual"+               <> ll el <> "l/" <> tl expected <> "c expected and "+               <> ll al <> "l/" <> tl actual <> "c actual"       diffReport = fmap (uncurry addnum) $                    zip [1..] $ concat $                    -- Highly simplistic "diff" output assumes@@ -398,5 +404,16 @@                    , fmap (de "∌ ") $ drop (length al) el                    , fmap (da "∹ ") $ drop (length el) al                    ]+                   -- n.b. T.lines seems to consume trailing whitespace before+                   -- newlines as well.  This will show any of this whitespace+                   -- difference on the last line, but not for other lines with+                   -- whitespace.+                   <> if el == al+                      then let maxlen = max (T.length expected) (T.length actual)+                               end x = T.drop (maxlen - 5) x+                           in [ [ de "∌ ending " $ visible $ end expected ]+                              , [ da "∹ ending " $ visible $ end actual ]+                              ]+                      else mempty       details = banner : diffReport   in if expected == actual then "<no difference>" else T.unpack (T.unlines details)
tasty-checklist.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.2 name:               tasty-checklist-version:            1.0.4.1+version:            1.0.5.0 synopsis:           Check multiple items during a tasty test description:    Allows the test to check a number of items during a test and@@ -13,7 +13,7 @@ license-file:       LICENSE author:             Kevin Quick maintainer:         kquick@galois.com-copyright:          Kevin Quick, 2021-2022+copyright:          Kevin Quick, 2021-2023 category:           Testing extra-source-files: CHANGELOG.md