packages feed

hunit-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.HUnit.DejaFu: DiscardResultAndTrace :: Discard
+ Test.HUnit.DejaFu: DiscardTrace :: Discard
+ Test.HUnit.DejaFu: data Discard :: *
+ Test.HUnit.DejaFu: defaultDiscarder :: Either Failure a -> Maybe Discard
+ Test.HUnit.DejaFu: testDejafuDiscard :: Show a => (Either Failure a -> Maybe Discard) -> Way -> MemType -> (forall t. ConcST t a) -> String -> Predicate a -> Test
+ Test.HUnit.DejaFu: testDejafuDiscardIO :: Show a => (Either Failure a -> Maybe Discard) -> Way -> MemType -> ConcIO a -> String -> Predicate a -> Test

Files

CHANGELOG.markdown view
@@ -7,6 +7,27 @@ *de facto* standard Haskell versioning scheme.  +0.7.0.0 [2017-08-10] (git tag: [hunit-dejafu-0.7.0.0][])+-------++https://hackage.haskell.org/package/hunit-dejafu-0.7.0.0++### Test.HUnit.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.++[hunit-dejafu-0.7.0.0]: https://github.com/barrucadu/dejafu/releases/tag/hunit-dejafu-0.7.0.0+++---------------------------------------------------------------------------------------------------++ 0.6.0.0 [2017-06-07] (git tag: [hunit-dejafu-0.6.0.0][]) ------- 
Test/HUnit/DejaFu.hs view
@@ -45,6 +45,8 @@   , testDejafuWay   , testDejafusWay +  , testDejafuDiscard+   -- ** @IO@   , testAutoIO   , testDejafuIO@@ -54,6 +56,8 @@   , testDejafuWayIO   , testDejafusWayIO +  , testDejafuDiscardIO+   -- ** Re-exports   , Way   , defaultWay@@ -65,6 +69,8 @@   , defaultBounds   , MemType(..)   , defaultMemType+  , Discard(..)+  , defaultDiscarder    -- * Refinement property testing   , testProperty@@ -96,11 +102,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  -------------------------------------------------------------------------------- -- HUnit-style unit testing@@ -124,12 +130,12 @@       conc' = try conc        runSCTst' :: Conc.ConcST t (Either HUnitFailure ()) -> [(Either Failure (Either HUnitFailure ()), Conc.Trace)]-      runSCTst' = unsafeCoerce $ runSCTst defaultWay defaultMemType+      runSCTst' = unsafeCoerce $ runSCTst (const Nothing) defaultWay defaultMemType  -- | @since 0.3.0.0 instance Assertable (Conc.ConcIO ()) where   assert conc = do-    traces <- runSCTio defaultWay defaultMemType (try conc)+    traces <- runSCTio (const Nothing) defaultWay defaultMemType (try conc)     assertString . showErr $ assertableP traces  assertableP :: Predicate (Either HUnitFailure ())@@ -221,9 +227,28 @@   -> Predicate a   -- ^ The predicate to check   -> Test-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+  -> Test+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.@@ -251,7 +276,7 @@   -> [(String, Predicate a)]   -- ^ The list of predicates (with names) to check   -> Test-testDejafusWay = testst+testDejafusWay = testst (const Nothing)  -- | Variant of 'testDejafu' for computations which do 'IO'. --@@ -264,9 +289,15 @@ -- @since 0.5.0.0 testDejafuWayIO :: Show a   => Way -> MemType -> Conc.ConcIO a -> String -> Predicate a -> Test-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 -> Test+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@@ -278,7 +309,7 @@ -- @since 0.5.0.0 testDejafusWayIO :: Show a   => Way -> MemType -> Conc.ConcIO a -> [(String, Predicate a)] -> Test-testDejafusWayIO = testio+testDejafusWayIO = testio (const Nothing)   -------------------------------------------------------------------------------@@ -302,8 +333,13 @@  -- | Produce a HUnit 'Test' from a Deja Fu test. testst :: Show a-  => Way -> MemType -> (forall t. Conc.ConcST t a) -> [(String, Predicate a)] -> Test-testst way memtype conc tests = case map toTest tests of+  => (Either Failure a -> Maybe Discard)+  -> Way+  -> MemType+  -> (forall t. Conc.ConcST t a)+  -> [(String, Predicate a)]+  -> Test+testst discard way memtype conc tests = case map toTest tests of   [t] -> t   ts  -> TestList ts @@ -311,12 +347,17 @@     toTest (name, p) = TestLabel name . TestCase $       assertString . showErr $ p traces -    traces = runSCTst way memtype conc+    traces = runSCTst discard way memtype conc  -- | Produce a HUnit 'Test' from an IO-using Deja Fu test. testio :: Show a-  => Way -> MemType -> Conc.ConcIO a -> [(String, Predicate a)] -> Test-testio way memtype concio tests = case map toTest tests of+  => (Either Failure a -> Maybe Discard)+  -> Way+  -> MemType+  -> Conc.ConcIO a+  -> [(String, Predicate a)]+  -> Test+testio discard way memtype concio tests = case map toTest tests of   [t] -> t   ts  -> TestList ts @@ -326,7 +367,7 @@       -- really unsafe) here, as 'test' doesn't allow side-effects       -- (eg, constructing an 'MVar' to share the traces after one       -- test computed them).-      traces <- runSCTio way memtype concio+      traces <- runSCTio discard way memtype concio       assertString . showErr $ p traces  -- | Produce a HUnit 'Test' from a Deja Fu refinement property test.
hunit-dejafu.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                hunit-dejafu-version:             0.6.0.0+version:             0.7.0.0 synopsis:            Deja Fu support for the HUnit test framework.  description:@@ -30,7 +30,7 @@ source-repository this   type:     git   location: https://github.com/barrucadu/dejafu.git-  tag:      hunit-dejafu-0.6.0.0+  tag:      hunit-dejafu-0.7.0.0  library   exposed-modules:     Test.HUnit.DejaFu@@ -38,7 +38,7 @@   -- other-extensions:       build-depends:       base       >=4.8 && <5                      , exceptions >=0.7 && <0.9-                     , dejafu     >=0.7 && <0.8+                     , dejafu     >=0.7.1 && <0.8                      , HUnit      >=1.2 && <1.7   -- hs-source-dirs:         default-language:    Haskell2010