File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 1+ ## 0.3.2
2+
3+ - Add 'ediffGolden1', a variant of 'ediffGolden' with an additional argument.
4+
15## 0.3.1
26
37- Support GHC-8.6.5...9.10.1
Original file line number Diff line number Diff line change 11-- | "Golden tests" using 'ediff' comparison.
22module Data.TreeDiff.Golden (
33 ediffGolden ,
4+ ediffGolden1 ,
45) where
56
67import Data.TreeDiff
@@ -41,9 +42,23 @@ ediffGolden
4142 -> FilePath -- ^ path to "golden file"
4243 -> IO a -- ^ result value
4344 -> testTree
44- ediffGolden impl testName fp x = impl testName expect actual cmp wrt
45+ ediffGolden impl testName fp x = ediffGolden1 impl' testName fp (\ () -> x) where
46+ impl' n expect actual = impl n expect (actual () )
47+
48+ -- | Like 'ediffGolden1' but with an additional argument for generation of actual value.
49+ --
50+ -- @since 0.3.2
51+ --
52+ ediffGolden1
53+ :: (Eq a , ToExpr a )
54+ => (testName -> IO Expr -> (arg -> IO Expr ) -> (Expr -> Expr -> IO (Maybe String )) -> (Expr -> IO () ) -> testTree ) -- ^ 'goldenTest'
55+ -> testName -- ^ test name
56+ -> FilePath -- ^ path to "golden file"
57+ -> (arg -> IO a ) -- ^ result value
58+ -> testTree
59+ ediffGolden1 impl testName fp x = impl testName expect actual cmp wrt
4560 where
46- actual = fmap toExpr x
61+ actual arg = fmap toExpr (x arg)
4762 expect = do
4863 contents <- BS. readFile fp
4964 case parse (exprParser <* eof) fp $ TE. decodeUtf8 contents of
Original file line number Diff line number Diff line change 11cabal-version : 2.2
22name : tree-diff
3- version : 0.3.1
4- x-revision : 1
3+ version : 0.3.2
54synopsis : Diffing of (expression) trees.
65category : Data, Testing
76description :
You can’t perform that action at this time.
0 commit comments