tree-diff 0.3.1 → 0.3.2
raw patch · 3 files changed
+24/−5 lines, 3 files
Files
- ChangeLog.md +4/−0
- src/Data/TreeDiff/Golden.hs +17/−2
- tree-diff.cabal +3/−3
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.3.2++- Add 'ediffGolden1', a variant of 'ediffGolden' with an additional argument.+ ## 0.3.1 - Support GHC-8.6.5...9.10.1
src/Data/TreeDiff/Golden.hs view
@@ -1,6 +1,7 @@ -- | "Golden tests" using 'ediff' comparison. module Data.TreeDiff.Golden ( ediffGolden,+ ediffGolden1, ) where import Data.TreeDiff@@ -41,9 +42,23 @@ -> FilePath -- ^ path to "golden file" -> IO a -- ^ result value -> testTree-ediffGolden impl testName fp x = impl testName expect actual cmp wrt+ediffGolden impl testName fp x = ediffGolden1 impl' testName fp (\() -> x) where+ impl' n expect actual = impl n expect (actual ())++-- | Like 'ediffGolden1' but with an additional argument for generation of actual value.+--+-- @since 0.3.2+--+ediffGolden1+ :: (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"+ -> (arg -> IO a) -- ^ result value+ -> testTree+ediffGolden1 impl testName fp x = impl testName expect actual cmp wrt where- actual = fmap toExpr x+ actual arg = fmap toExpr (x arg) expect = do contents <- BS.readFile fp case parse (exprParser <* eof) fp $ TE.decodeUtf8 contents of
tree-diff.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: tree-diff-version: 0.3.1+version: 0.3.2 synopsis: Diffing of (expression) trees. category: Data, Testing description:@@ -93,7 +93,7 @@ , aeson ^>=2.2.0.0 , ansi-terminal ^>=1.1 , ansi-wl-pprint ^>=1.0.2- , hashable ^>=1.4.4.0+ , hashable ^>=1.4.4.0 || ^>=1.5.0.0 , parsers ^>=0.12.11 , primitive ^>=0.9.0.0 , QuickCheck ^>=2.14.2 || ^>=2.15@@ -152,7 +152,7 @@ build-depends: , tasty ^>=1.5 , tasty-golden ^>=2.3.5- , tasty-quickcheck ^>=0.10.3+ , tasty-quickcheck ^>=0.10.3 || ^>=0.11 , trifecta ^>=2.1.4 benchmark tree-diff-bench