packages feed

tasty-golden 2.3.0.2 → 2.3.1

raw patch · 3 files changed

+34/−22 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,6 +1,12 @@ Changes ======= +Version 2.3.1+-------------++Intercept exceptions thrown by the test, adhering to the new tasty API+contract.+ Version 2.3.0.2 --------------- 
Test/Tasty/Golden/Internal.hs view
@@ -45,31 +45,37 @@ runGolden :: Golden -> AcceptTests -> IO Result runGolden (Golden getGolden getTested cmp update) (AcceptTests accept) = do   do-    new <- getTested-    mbRef <- try getGolden+    mbNew <- try getTested -    case mbRef of-      Left e | isDoesNotExistError e -> do-        update new-        return $ testPassed "Golden file did not exist; created"+    case mbNew of+      Left e -> do+        return $ testFailed $ show (e :: SomeException)+      Right new -> do -        | otherwise -> throwIO e+        mbRef <- try getGolden -      Right ref -> do+        case mbRef of+          Left e | isDoesNotExistError e -> do+            update new+            return $ testPassed "Golden file did not exist; created" -        result <- cmp ref new+            | otherwise -> throwIO e -        case result of-          Just _reason | accept -> do-            -- test failed; accept the new version-            update new-            return $ testPassed "Accepted the new version"+          Right ref -> do -          Just reason -> do-            -- Make sure that the result is fully evaluated and doesn't depend-            -- on yet un-read lazy input-            evaluate . rnf $ reason-            return $ testFailed reason+            result <- cmp ref new -          Nothing ->-            return $ testPassed ""+            case result of+              Just _reason | accept -> do+                -- test failed; accept the new version+                update new+                return $ testPassed "Accepted the new version"++              Just reason -> do+                -- Make sure that the result is fully evaluated and doesn't depend+                -- on yet un-read lazy input+                evaluate . rnf $ reason+                return $ testFailed reason++              Nothing ->+                return $ testPassed ""
tasty-golden.cabal view
@@ -1,5 +1,5 @@ name:                tasty-golden-version:             2.3.0.2+version:             2.3.1 synopsis:            Golden tests support for tasty description:   This package provides support for «golden testing».