File tree 3 files changed +22
-4
lines changed
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
+
1
5
## 0.3.1
2
6
3
7
- Support GHC-8.6.5...9.10.1
Original file line number Diff line number Diff line change 1
1
-- | "Golden tests" using 'ediff' comparison.
2
2
module Data.TreeDiff.Golden (
3
3
ediffGolden ,
4
+ ediffGolden1 ,
4
5
) where
5
6
6
7
import Data.TreeDiff
@@ -41,9 +42,23 @@ ediffGolden
41
42
-> FilePath -- ^ path to "golden file"
42
43
-> IO a -- ^ result value
43
44
-> 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
45
60
where
46
- actual = fmap toExpr x
61
+ actual arg = fmap toExpr (x arg)
47
62
expect = do
48
63
contents <- BS. readFile fp
49
64
case parse (exprParser <* eof) fp $ TE. decodeUtf8 contents of
Original file line number Diff line number Diff line change 1
1
cabal-version : 2.2
2
2
name : tree-diff
3
- version : 0.3.1
4
- x-revision : 1
3
+ version : 0.3.2
5
4
synopsis : Diffing of (expression) trees.
6
5
category : Data, Testing
7
6
description :
You can’t perform that action at this time.
0 commit comments