tasty-dejafu 0.6.0.0 → 0.7.0.0
raw patch · 3 files changed
+83/−21 lines, 3 filesdep ~dejafuPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: dejafu
API changes (from Hackage documentation)
+ Test.Tasty.DejaFu: DiscardResultAndTrace :: Discard
+ Test.Tasty.DejaFu: DiscardTrace :: Discard
+ Test.Tasty.DejaFu: data Discard :: *
+ Test.Tasty.DejaFu: defaultDiscarder :: Either Failure a -> Maybe Discard
+ Test.Tasty.DejaFu: testDejafuDiscard :: Show a => (Either Failure a -> Maybe Discard) -> Way -> MemType -> (forall t. ConcST t a) -> String -> Predicate a -> TestTree
+ Test.Tasty.DejaFu: testDejafuDiscardIO :: Show a => (Either Failure a -> Maybe Discard) -> Way -> MemType -> ConcIO a -> String -> Predicate a -> TestTree
Files
- CHANGELOG.markdown +21/−0
- Test/Tasty/DejaFu.hs +59/−18
- tasty-dejafu.cabal +3/−3
CHANGELOG.markdown view
@@ -7,6 +7,27 @@ *de facto* standard Haskell versioning scheme. +0.7.0.0 [2017-08-10] (git tag: [tasty-dejafu-0.7.0.0][])+-------++https://hackage.haskell.org/package/tasty-dejafu-0.6.0.0++### Test.Tasty.DejaFu++- Two new functions: `testDejafuDiscard` and `testDejafuDiscardIO`, allowing you to selectively+ discard results or traces.+- The `Discard` type and `defaultDiscarder` function from dejafu is now re-exported.++### Miscellaneous++- Lower version bound on dejafu raised to 0.7.1.0.++[tasty-dejafu-0.7.0.0]: https://github.com/barrucadu/dejafu/releases/tag/tasty-dejafu-0.7.0.0+++---------------------------------------------------------------------------------------------------++ 0.6.0.0 [2017-04-08] (git tag: [tasty-dejafu-0.6.0.0][]) -------
Test/Tasty/DejaFu.hs view
@@ -42,6 +42,8 @@ , testDejafuWay , testDejafusWay + , testDejafuDiscard+ -- ** @IO@ , testAutoIO , testDejafuIO@@ -51,6 +53,8 @@ , testDejafuWayIO , testDejafusWayIO + , testDejafuDiscardIO+ -- ** Re-exports , Way , defaultWay@@ -62,6 +66,8 @@ , defaultBounds , MemType(..) , defaultMemType+ , Discard(..)+ , defaultDiscarder -- * Refinement property testing , testProperty@@ -99,11 +105,11 @@ -- instance :( import Unsafe.Coerce (unsafeCoerce) -runSCTst :: Way -> MemType -> (forall t. Conc.ConcST t a) -> [(Either Failure a, Conc.Trace)]-runSCTst way memtype conc = runST (SCT.runSCT way memtype conc)+runSCTst :: (Either Failure a -> Maybe Discard) -> Way -> MemType -> (forall t. Conc.ConcST t a) -> [(Either Failure a, Conc.Trace)]+runSCTst discard way memtype conc = runST (SCT.runSCTDiscard discard way memtype conc) -runSCTio :: Way -> MemType -> Conc.ConcIO a -> IO [(Either Failure a, Conc.Trace)]-runSCTio = SCT.runSCT+runSCTio :: (Either Failure a -> Maybe Discard) -> Way -> MemType -> Conc.ConcIO a -> IO [(Either Failure a, Conc.Trace)]+runSCTio = SCT.runSCTDiscard -------------------------------------------------------------------------------- -- Tasty-style unit testing@@ -116,7 +122,7 @@ let memtype = lookupOption options :: MemType let way = lookupOption options :: Way let runSCTst' :: Conc.ConcST t (Maybe String) -> [(Either Failure (Maybe String), Conc.Trace)]- runSCTst' = unsafeCoerce $ runSCTst way memtype+ runSCTst' = unsafeCoerce $ runSCTst (const Nothing) way memtype let traces = runSCTst' conc run options (ConcTest traces assertableP) callback @@ -127,7 +133,7 @@ run options conc callback = do let memtype = lookupOption options let way = lookupOption options- let traces = runSCTio way memtype conc+ let traces = runSCTio (const Nothing) way memtype conc run options (ConcIOTest traces assertableP) callback concOptions :: [OptionDescription]@@ -245,9 +251,28 @@ -> Predicate a -- ^ The predicate to check -> TestTree-testDejafuWay way memtype conc name p =- testDejafusWay way memtype conc [(name, p)]+testDejafuWay = testDejafuDiscard (const Nothing) +-- | Variant of 'testDejafuWay' which can selectively discard results.+--+-- @since 0.7.0.0+testDejafuDiscard :: Show a+ => (Either Failure a -> Maybe Discard)+ -- ^ Selectively discard results.+ -> Way+ -- ^ How to execute the concurrent program.+ -> MemType+ -- ^ The memory model to use for non-synchronised @CRef@ operations.+ -> (forall t. Conc.ConcST t a)+ -- ^ The computation to test+ -> String+ -- ^ The name of the test.+ -> Predicate a+ -- ^ The predicate to check+ -> TestTree+testDejafuDiscard discard way memtype conc name test =+ testst discard way memtype conc [(name, test)]+ -- | Variant of 'testDejafu' which takes a collection of predicates to -- test. This will share work between the predicates, rather than -- running the concurrent computation many times for each predicate.@@ -275,7 +300,7 @@ -> [(TestName, Predicate a)] -- ^ The list of predicates (with names) to check -> TestTree-testDejafusWay = testst+testDejafusWay = testst (const Nothing) -- | Variant of 'testDejafu' for computations which do 'IO'. --@@ -288,9 +313,15 @@ -- @since 0.5.0.0 testDejafuWayIO :: Show a => Way -> MemType -> Conc.ConcIO a -> TestName -> Predicate a -> TestTree-testDejafuWayIO way memtype concio name p =- testDejafusWayIO way memtype concio [(name, p)]+testDejafuWayIO = testDejafuDiscardIO (const Nothing) +-- | Variant of 'testDejafuDiscard' for computations which do 'IO'.+--+-- @since 0.7.0.0+testDejafuDiscardIO :: Show a => (Either Failure a -> Maybe Discard) -> Way -> MemType -> Conc.ConcIO a -> String -> Predicate a -> TestTree+testDejafuDiscardIO discard way memtype concio name test =+ testio discard way memtype concio [(name, test)]+ -- | Variant of 'testDejafus' for computations which do 'IO'. -- -- @since 0.2.0.0@@ -302,7 +333,7 @@ -- @since 0.5.0.0 testDejafusWayIO :: Show a => Way -> MemType -> Conc.ConcIO a -> [(TestName, Predicate a)] -> TestTree-testDejafusWayIO = testio+testDejafusWayIO = testio (const Nothing) -------------------------------------------------------------------------------@@ -368,20 +399,30 @@ -- | Produce a Tasty 'TestTree' from a Deja Fu test. testst :: Show a- => Way -> MemType -> (forall t. Conc.ConcST t a) -> [(TestName, Predicate a)] -> TestTree-testst way memtype conc tests = case map toTest tests of+ => (Either Failure a -> Maybe Discard)+ -> Way+ -> MemType+ -> (forall t. Conc.ConcST t a)+ -> [(TestName, Predicate a)]+ -> TestTree+testst discard way memtype conc tests = case map toTest tests of [t] -> t ts -> testGroup "Deja Fu Tests" ts where toTest (name, p) = singleTest name $ ConcTest traces p - traces = runSCTst way memtype conc+ traces = runSCTst discard way memtype conc -- | Produce a Tasty 'Test' from an IO-using Deja Fu test. testio :: Show a- => Way -> MemType -> Conc.ConcIO a -> [(TestName, Predicate a)] -> TestTree-testio way memtype concio tests = case map toTest tests of+ => (Either Failure a -> Maybe Discard)+ -> Way+ -> MemType+ -> Conc.ConcIO a+ -> [(TestName, Predicate a)]+ -> TestTree+testio discard way memtype concio tests = case map toTest tests of [t] -> t ts -> testGroup "Deja Fu Tests" ts @@ -390,7 +431,7 @@ -- As with HUnit, constructing a test is side-effect free, so -- sharing of traces can't happen here.- traces = runSCTio way memtype concio+ traces = runSCTio discard way memtype 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: 0.6.0.0+version: 0.7.0.0 synopsis: Deja Fu support for the Tasty test framework. description:@@ -30,14 +30,14 @@ source-repository this type: git location: https://github.com/barrucadu/dejafu.git- tag: tasty-dejafu-0.6.0.0+ tag: tasty-dejafu-0.7.0.0 library exposed-modules: Test.Tasty.DejaFu -- other-modules: -- other-extensions: build-depends: base >=4.8 && <5- , dejafu >=0.7 && <0.8+ , dejafu >=0.7.1 && <0.8 , random >=1.0 && <1.2 , tagged >=0.8 && <0.9 , tasty >=0.10 && <0.12