tasty-dejafu 2.0.0.9 → 2.1.0.0
raw patch · 3 files changed
+54/−26 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Test.Tasty.DejaFu: testAuto :: (Eq a, Show a) => Program pty IO a -> TestTree
+ Test.Tasty.DejaFu: testAuto :: (Eq a, Show a) => TestName -> Program pty IO a -> TestTree
- Test.Tasty.DejaFu: testAutoWay :: (Eq a, Show a) => Way -> MemType -> Program pty IO a -> TestTree
+ Test.Tasty.DejaFu: testAutoWay :: (Eq a, Show a) => Way -> MemType -> TestName -> Program pty IO a -> TestTree
- Test.Tasty.DejaFu: testAutoWithSettings :: (Eq a, Show a) => Settings IO a -> Program pty IO a -> TestTree
+ Test.Tasty.DejaFu: testAutoWithSettings :: (Eq a, Show a) => Settings IO a -> TestName -> Program pty IO a -> TestTree
- Test.Tasty.DejaFu: testDejafus :: Show b => [(TestName, ProPredicate a b)] -> Program pty IO a -> TestTree
+ Test.Tasty.DejaFu: testDejafus :: Show b => TestName -> [(TestName, ProPredicate a b)] -> Program pty IO a -> TestTree
- Test.Tasty.DejaFu: testDejafusWay :: Show b => Way -> MemType -> [(TestName, ProPredicate a b)] -> Program pty IO a -> TestTree
+ Test.Tasty.DejaFu: testDejafusWay :: Show b => Way -> MemType -> TestName -> [(TestName, ProPredicate a b)] -> Program pty IO a -> TestTree
- Test.Tasty.DejaFu: testDejafusWithSettings :: Show b => Settings IO a -> [(TestName, ProPredicate a b)] -> Program pty IO a -> TestTree
+ Test.Tasty.DejaFu: testDejafusWithSettings :: Show b => Settings IO a -> TestName -> [(TestName, ProPredicate a b)] -> Program pty IO a -> TestTree
Files
- CHANGELOG.rst +22/−2
- Test/Tasty/DejaFu.hs +30/−22
- tasty-dejafu.cabal +2/−2
CHANGELOG.rst view
@@ -7,6 +7,26 @@ .. _PVP: https://pvp.haskell.org/ +2.1.0.0 (2022-08-31)+--------------------++* Git: :tag:`tasty-dejafu-2.1.0.0`+* Hackage: :hackage:`tasty-dejafu-2.1.0.0`++Changed+~~~~~~~++* (:issue:`361`) The following functions take a ``TestName`` parameter+ to name the test group, rather than using "Deja Fu Tests":++ * ``Test.Tasty.DejaFu.testAuto``+ * ``Test.Tasty.DejaFu.testAutoWay``+ * ``Test.Tasty.DejaFu.testAutoWithSettings``+ * ``Test.Tasty.DejaFu.testDejafus``+ * ``Test.Tasty.DejaFu.testDejafusWay``+ * ``Test.Tasty.DejaFu.testDejafusWithSettings``++ 2.0.0.9 (2022-08-30) -------------------- @@ -16,7 +36,7 @@ Fixed ~~~~~ -* Remove inaccurate comment about ```Test.Tasty.DejaFu.testDejafus``+* Remove inaccurate comment about ``Test.Tasty.DejaFu.testDejafus`` sharing work. @@ -143,7 +163,7 @@ * ``Test.Tasty.DejaFu.inspectMVar`` * ``Test.Tasty.DejaFu.inspectTVar`` -Changes+Changed ~~~~~~~ * Functions which took a ``ConcIO`` now take a ``Program pty IO``:
Test/Tasty/DejaFu.hs view
@@ -5,7 +5,7 @@ -- | -- Module : Test.Tasty.DejaFu--- Copyright : (c) 2015--2019 Michael Walker+-- Copyright : (c) 2015--2022 Michael Walker -- License : MIT -- Maintainer : Michael Walker <mike@barrucadu.co.uk> -- Stability : stable@@ -146,9 +146,11 @@ -- | Automatically test a computation. In particular, look for -- deadlocks, uncaught exceptions, and multiple return values. ----- @since 2.0.0.0+-- @since 2.1.0.0 testAuto :: (Eq a, Show a)- => Program pty IO a+ => TestName+ -- ^ The name of the test group.+ -> Program pty IO a -- ^ The computation to test. -> TestTree testAuto = testAutoWithSettings defaultSettings@@ -156,12 +158,14 @@ -- | Variant of 'testAuto' which tests a computation under a given -- execution way and memory model. ----- @since 2.0.0.0+-- @since 2.1.0.0 testAutoWay :: (Eq a, Show a) => Way -- ^ How to execute the concurrent program. -> MemType -- ^ The memory model to use for non-synchronised @IORef@ operations.+ -> TestName+ -- ^ The name of the test group. -> Program pty IO a -- ^ The computation to test. -> TestTree@@ -169,14 +173,16 @@ -- | Variant of 'testAuto' which takes a settings record. ----- @since 2.0.0.0+-- @since 2.1.0.0 testAutoWithSettings :: (Eq a, Show a) => Settings IO a -- ^ The SCT settings.+ -> TestName+ -- ^ The name of the test group. -> Program pty IO a -- ^ The computation to test. -> TestTree-testAutoWithSettings settings = testDejafusWithSettings settings+testAutoWithSettings settings groupName = testDejafusWithSettings settings groupName [("Never Deadlocks", representative deadlocksNever) , ("No Exceptions", representative exceptionsNever) , ("Consistent Result", alwaysSame)@@ -226,14 +232,17 @@ -> Program pty IO a -- ^ The computation to test. -> TestTree-testDejafuWithSettings settings name p = testDejafusWithSettings settings [(name, p)]+testDejafuWithSettings settings name p concio =+ testconc settings concio (name, p) -- | Variant of 'testDejafu' which takes a collection of predicates to -- test. ----- @since 2.0.0.0+-- @since 2.1.0.0 testDejafus :: Show b- => [(TestName, ProPredicate a b)]+ => TestName+ -- ^ The name of the test group.+ -> [(TestName, ProPredicate a b)] -- ^ The list of predicates (with names) to check. -> Program pty IO a -- ^ The computation to test.@@ -243,12 +252,14 @@ -- | Variant of 'testDejafus' which takes a way to execute the program -- and a memory model. ----- @since 2.0.0.0+-- @since 2.1.0.0 testDejafusWay :: Show b => Way -- ^ How to execute the concurrent program. -> MemType -- ^ The memory model to use for non-synchronised @IORef@ operations.+ -> TestName+ -- ^ The name of the test group. -> [(TestName, ProPredicate a b)] -- ^ The list of predicates (with names) to check. -> Program pty IO a@@ -258,16 +269,19 @@ -- | Variant of 'testDejafus' which takes a settings record. ----- @since 2.0.0.0+-- @since 2.1.0.0 testDejafusWithSettings :: Show b => Settings IO a -- ^ The SCT settings.+ -> TestName+ -- ^ The name of the test group. -> [(TestName, ProPredicate a b)] -- ^ The list of predicates (with names) to check. -> Program pty IO a -- ^ The computation to test. -> TestTree-testDejafusWithSettings = testconc+testDejafusWithSettings settings groupName tests concio =+ testGroup groupName $ map (testconc settings concio) tests -------------------------------------------------------------------------------@@ -341,18 +355,12 @@ -- | Produce a Tasty 'Test' from a Deja Fu unit test. testconc :: Show b => Settings IO a- -> [(TestName, ProPredicate a b)] -> Program pty IO a+ -> (TestName, ProPredicate a b) -> TestTree-testconc settings tests concio = case map toTest tests of- [t] -> t- ts -> testGroup "Deja Fu Tests" ts-- where- toTest (name, p) =- let discarder = maybe id D.strengthenDiscard (get ldiscard settings) (pdiscard p)- traces = SCT.runSCTWithSettings (set ldiscard (Just discarder) settings) concio- in singleTest name $ ConcTest traces (peval p)+testconc settings concio (name, p) = singleTest name $ ConcTest traces (peval p) where+ discarder = maybe id D.strengthenDiscard (get ldiscard settings) (pdiscard p)+ traces = SCT.runSCTWithSettings (set ldiscard (Just discarder) settings) concio -- | Produce a Tasty 'TestTree' from a Deja Fu refinement property test. testprop :: (R.Testable p, R.Listable (R.X p), Eq (R.X p), Show (R.X p), Show (R.O p))
tasty-dejafu.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: tasty-dejafu-version: 2.0.0.9+version: 2.1.0.0 synopsis: Deja Fu support for the Tasty test framework. description:@@ -30,7 +30,7 @@ source-repository this type: git location: https://github.com/barrucadu/dejafu.git- tag: tasty-dejafu-2.0.0.9+ tag: tasty-dejafu-2.1.0.0 library exposed-modules: Test.Tasty.DejaFu