packages feed

tree-diff 0.3.2 → 0.3.3

raw patch · 3 files changed

+15/−3 lines, 3 files

Files

ChangeLog.md view
@@ -1,3 +1,9 @@+## 0.3.3++- Change 'ediffGolden' so that parse errors in expected file don't cause the hard failure.+  This way you may `--accept` new results even when expected files are broken, e.g. due merge conflict markers.+  For now the change is a bit a hack to avoid breaking change in type-signature of `ediffGolden/1`.+ ## 0.3.2  - Add 'ediffGolden1', a variant of 'ediffGolden' with an additional argument.
src/Data/TreeDiff/Golden.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ScopedTypeVariables #-} -- | "Golden tests" using 'ediff' comparison. module Data.TreeDiff.Golden (     ediffGolden,@@ -50,7 +51,7 @@ -- @since 0.3.2 -- ediffGolden1-    :: (Eq a, ToExpr a)+    :: forall a arg testName testTree. (Eq a, ToExpr a)     => (testName -> IO Expr -> (arg -> IO Expr) -> (Expr -> Expr -> IO (Maybe String)) -> (Expr -> IO ()) -> testTree) -- ^ 'goldenTest'     -> testName  -- ^ test name     -> FilePath  -- ^ path to "golden file"@@ -58,12 +59,17 @@     -> testTree ediffGolden1 impl testName fp x = impl testName expect actual cmp wrt   where+    actual :: arg -> IO Expr     actual arg = fmap toExpr (x arg)++    expect :: IO Expr     expect = do         contents <- BS.readFile fp         case parse (exprParser <* eof) fp $ TE.decodeUtf8 contents of-            Left err -> print err >> fail "parse error"+            Left err -> return $ App "ParseError" [toExpr fp, toExpr (show err)]             Right r  -> return r++    cmp :: Expr -> Expr -> IO (Maybe [Char])     cmp a b         | a == b    = return Nothing         | otherwise = return $ Just $
tree-diff.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.2 name:               tree-diff-version:            0.3.2+version:            0.3.3 synopsis:           Diffing of (expression) trees. category:           Data, Testing description: