sydtest 0.20.0.1 → 0.21.0.0
raw patch · 9 files changed
+51/−13 lines, 9 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Test.Syd: aroundAllWithAll :: forall newOuter oldOuter (otherOuters :: [Type]) inner result. ((newOuter -> IO ()) -> HList (oldOuter ': otherOuters) -> IO ()) -> TestDefM (newOuter ': (oldOuter ': otherOuters)) inner result -> TestDefM (oldOuter ': otherOuters) inner result
+ Test.Syd: setupAroundAllWithAll :: forall oldOuter (outers :: [Type]) newOuter inner result. (HList (oldOuter ': outers) -> SetupFunc newOuter) -> TestDefM (newOuter ': (oldOuter ': outers)) inner result -> TestDefM (oldOuter ': outers) inner result
+ Test.Syd.Def.AroundAll: aroundAllWithAll :: forall newOuter oldOuter (otherOuters :: [Type]) inner result. ((newOuter -> IO ()) -> HList (oldOuter ': otherOuters) -> IO ()) -> TestDefM (newOuter ': (oldOuter ': otherOuters)) inner result -> TestDefM (oldOuter ': otherOuters) inner result
+ Test.Syd.Def.SetupFunc: setupAroundAllWithAll :: forall oldOuter (outers :: [Type]) newOuter inner result. (HList (oldOuter ': outers) -> SetupFunc newOuter) -> TestDefM (newOuter ': (oldOuter ': outers)) inner result -> TestDefM (oldOuter ': outers) inner result
- Test.Syd: [DefAroundAllWithNode] :: forall newOuter oldOuter (otherOuters :: [Type]) inner extra. ((newOuter -> IO ()) -> oldOuter -> IO ()) -> SpecDefForest (newOuter ': (oldOuter ': otherOuters)) inner extra -> SpecDefTree (oldOuter ': otherOuters) inner extra
+ Test.Syd: [DefAroundAllWithNode] :: forall newOuter oldOuter (otherOuters :: [Type]) inner extra. ((newOuter -> IO ()) -> HList (oldOuter ': otherOuters) -> IO ()) -> SpecDefForest (newOuter ': (oldOuter ': otherOuters)) inner extra -> SpecDefTree (oldOuter ': otherOuters) inner extra
- Test.Syd.SpecDef: [DefAroundAllWithNode] :: forall newOuter oldOuter (otherOuters :: [Type]) inner extra. ((newOuter -> IO ()) -> oldOuter -> IO ()) -> SpecDefForest (newOuter ': (oldOuter ': otherOuters)) inner extra -> SpecDefTree (oldOuter ': otherOuters) inner extra
+ Test.Syd.SpecDef: [DefAroundAllWithNode] :: forall newOuter oldOuter (otherOuters :: [Type]) inner extra. ((newOuter -> IO ()) -> HList (oldOuter ': otherOuters) -> IO ()) -> SpecDefForest (newOuter ': (oldOuter ': otherOuters)) inner extra -> SpecDefTree (oldOuter ': otherOuters) inner extra
Files
- CHANGELOG.md +15/−0
- src/Test/Syd.hs +2/−0
- src/Test/Syd/Def/AroundAll.hs +14/−2
- src/Test/Syd/Def/SetupFunc.hs +9/−0
- src/Test/Syd/Runner/Asynchronous.hs +3/−3
- src/Test/Syd/Runner/Synchronous/Interleaved.hs +3/−3
- src/Test/Syd/Runner/Synchronous/Separate.hs +3/−3
- src/Test/Syd/SpecDef.hs +1/−1
- sydtest.cabal +1/−1
CHANGELOG.md view
@@ -1,5 +1,20 @@ # Changelog +## [0.21.0.0] - 2025-05-09++This is technically a breaking change, but if you are not using the sydtest+constructors directly, it should not break anything for you.++### Added++* `aroundAllWithAll`+* `setupAroundAllWithAll`++### Changed++* Gave the 'DefAroundAllWithNode' constructor access to all outer resources+ instead of just the latest one.+ ## [0.20.0.1] - 2025-05-09 ### Added
src/Test/Syd.hs view
@@ -133,6 +133,7 @@ aroundAll, aroundAll_, aroundAllWith,+ aroundAllWithAll, -- *** Dependencies around each of a group of tests before,@@ -158,6 +159,7 @@ -- ****** AroundAll setupAroundAll, setupAroundAllWith,+ setupAroundAllWithAll, -- *** Declaring different test settings modifyMaxSuccess,
src/Test/Syd/Def/AroundAll.hs view
@@ -114,7 +114,8 @@ TestDefM otherOuters inner result aroundAll func = wrapForest $ \forest -> DefAroundAllNode func forest --- | Run a custom action before and/or after all spec items in a group to provide access to a resource 'a' while using a resource 'b'+-- | Run a custom action before and/or after all spec items in a group to+-- provide access to a resource 'a' while using a resource 'b' -- -- See the @FOOTGUN@ note in the docs for 'around_'. aroundAllWith ::@@ -123,7 +124,18 @@ ((newOuter -> IO ()) -> (oldOuter -> IO ())) -> TestDefM (newOuter ': oldOuter ': otherOuters) inner result -> TestDefM (oldOuter ': otherOuters) inner result-aroundAllWith func = wrapForest $ \forest -> DefAroundAllWithNode func forest+aroundAllWith func = wrapForest $ \forest ->+ DefAroundAllWithNode (\useNew (HCons x _) -> func useNew x) forest++-- | Run a custom action before and/or after all spec items in a group to+-- provide access to a resource 'a' while using all outer resources.+aroundAllWithAll ::+ forall newOuter oldOuter otherOuters inner result.+ -- | The function that provides the new outer resource (once), using the old outer resource.+ ((newOuter -> IO ()) -> (HList (oldOuter ': otherOuters) -> IO ())) ->+ TestDefM (newOuter ': oldOuter ': otherOuters) inner result ->+ TestDefM (oldOuter ': otherOuters) inner result+aroundAllWithAll func = wrapForest $ \forest -> DefAroundAllWithNode func forest -- | Declare a node in the spec def forest wrapForest ::
src/Test/Syd/Def/SetupFunc.hs view
@@ -111,3 +111,12 @@ setupAroundAllWith sf = aroundAllWith $ \takeNewOuter oldOuter -> let SetupFunc provideNewOuter = sf oldOuter in provideNewOuter $ \newOuter -> takeNewOuter newOuter++-- | Use 'aroundAllWithAll' with a 'SetupFunc'+setupAroundAllWithAll ::+ (HList (oldOuter ': outers) -> SetupFunc newOuter) ->+ TestDefM (newOuter ': oldOuter ': outers) inner result ->+ TestDefM (oldOuter ': outers) inner result+setupAroundAllWithAll sf = aroundAllWithAll $ \takeNewOuter oldOuter ->+ let SetupFunc provideNewOuter = sf oldOuter+ in provideNewOuter $ \newOuter -> takeNewOuter newOuter
src/Test/Syd/Runner/Asynchronous.hs view
@@ -261,16 +261,16 @@ ) DefAroundAllWithNode func sdf -> do e <- ask- let HCons x _ = eExternalResources e+ let outers = eExternalResources e liftIO $ func ( \b -> do runReaderT (goForest sdf)- (e {eExternalResources = HCons b (eExternalResources e)})+ (e {eExternalResources = HCons b outers}) waitForWorkersDone )- x+ outers DefAfterAllNode func sdf -> do e <- ask liftIO $
src/Test/Syd/Runner/Synchronous/Interleaved.hs view
@@ -139,7 +139,7 @@ ) DefAroundAllWithNode func sdf -> do e <- ask- let HCons x _ = eExternalResources e+ let outers = eExternalResources e liftIO $ fmap SubForestNode <$> applySimpleWrapper@@ -147,9 +147,9 @@ ( \b -> runReaderT (goForest sdf)- (e {eExternalResources = HCons b (eExternalResources e)})+ (e {eExternalResources = HCons b outers}) )- x+ outers DefAfterAllNode func sdf -> do e <- ask let externalResources = eExternalResources e
src/Test/Syd/Runner/Synchronous/Separate.hs view
@@ -98,7 +98,7 @@ ) DefAroundAllWithNode func sdf -> do e <- ask- let HCons x _ = eExternalResources e+ let outers = eExternalResources e liftIO $ fmap SubForestNode <$> applySimpleWrapper@@ -106,9 +106,9 @@ ( \b -> runReaderT (goForest sdf)- (e {eExternalResources = HCons b (eExternalResources e)})+ (e {eExternalResources = HCons b outers}) )- x+ outers DefAfterAllNode func sdf -> do e <- ask let externalResources = eExternalResources e
src/Test/Syd/SpecDef.hs view
@@ -107,7 +107,7 @@ SpecDefTree otherOuters inner extra DefAroundAllWithNode :: -- | The function that provides the new outer resource (once), using the old outer resource.- ((newOuter -> IO ()) -> (oldOuter -> IO ())) ->+ ((newOuter -> IO ()) -> (HList (oldOuter ': otherOuters) -> IO ())) -> SpecDefForest (newOuter ': oldOuter ': otherOuters) inner extra -> SpecDefTree (oldOuter ': otherOuters) inner extra DefAfterAllNode ::
sydtest.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: sydtest-version: 0.20.0.1+version: 0.21.0.0 synopsis: A modern testing framework for Haskell with good defaults and advanced testing features. description: A modern testing framework for Haskell with good defaults and advanced testing features. Sydtest aims to make the common easy and the hard possible. See https://github.com/NorfairKing/sydtest#readme for more information. category: Testing