polysemy-test 0.5.0.0 → 0.6.0.0
raw patch · 4 files changed
+38/−17 lines, 4 filesdep ~hedgehogdep ~incipit-coredep ~pathPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hedgehog, incipit-core, path, polysemy, tasty
API changes (from Hackage documentation)
- Polysemy.Test: runTestAuto :: HasCallStack => Sem [Test, Fail, Error TestError, Hedgehog IO, Embed IO, Resource, Final IO] a -> TestT IO a
+ Polysemy.Test: runTestAuto :: HasCallStack => Sem [Test, Fail, Error TestError, Hedgehog IO, Error Failure, Embed IO, Resource, Final IO] a -> TestT IO a
- Polysemy.Test: runTestAutoWith :: HasCallStack => Members [Resource, Embed IO] r => (forall x. Sem r x -> IO x) -> Sem (Test : (Fail : (Error TestError : (Hedgehog IO : r)))) a -> TestT IO a
+ Polysemy.Test: runTestAutoWith :: HasCallStack => Members [Resource, Embed IO] r => (forall x. Sem r x -> IO x) -> Sem (Test : (Fail : (Error TestError : (Hedgehog IO : (Error Failure : r))))) a -> TestT IO a
- Polysemy.Test: semToTestT :: Monad m => Member (Embed m) r => (forall x. Sem r x -> m x) -> Sem (Fail : (Error TestError : (Hedgehog m : r))) a -> TestT m a
+ Polysemy.Test: semToTestT :: Monad m => Member (Embed m) r => (forall x. Sem r x -> m x) -> Sem (Fail : (Error TestError : (Hedgehog m : (Error Failure : r)))) a -> TestT m a
- Polysemy.Test: semToTestTFinal :: Monad m => Sem [Fail, Error TestError, Hedgehog m, Embed m, Final m] a -> TestT m a
+ Polysemy.Test: semToTestTFinal :: Monad m => Sem [Fail, Error TestError, Hedgehog m, Error Failure, Embed m, Final m] a -> TestT m a
- Polysemy.Test: unwrapLiftedTestT :: forall m r a. Monad m => Member (Embed m) r => Sem (Fail : (Error TestError : (Hedgehog m : r))) a -> Sem r (Journal, Either Failure a)
+ Polysemy.Test: unwrapLiftedTestT :: forall m r a. Monad m => Member (Embed m) r => Sem (Fail : (Error TestError : (Hedgehog m : (Error Failure : r)))) a -> Sem r (Journal, Either Failure a)
- Polysemy.Test.Run: runTestAuto :: HasCallStack => Sem [Test, Fail, Error TestError, Hedgehog IO, Embed IO, Resource, Final IO] a -> TestT IO a
+ Polysemy.Test.Run: runTestAuto :: HasCallStack => Sem [Test, Fail, Error TestError, Hedgehog IO, Error Failure, Embed IO, Resource, Final IO] a -> TestT IO a
- Polysemy.Test.Run: runTestAutoWith :: HasCallStack => Members [Resource, Embed IO] r => (forall x. Sem r x -> IO x) -> Sem (Test : (Fail : (Error TestError : (Hedgehog IO : r)))) a -> TestT IO a
+ Polysemy.Test.Run: runTestAutoWith :: HasCallStack => Members [Resource, Embed IO] r => (forall x. Sem r x -> IO x) -> Sem (Test : (Fail : (Error TestError : (Hedgehog IO : (Error Failure : r))))) a -> TestT IO a
- Polysemy.Test.Run: semToTestT :: Monad m => Member (Embed m) r => (forall x. Sem r x -> m x) -> Sem (Fail : (Error TestError : (Hedgehog m : r))) a -> TestT m a
+ Polysemy.Test.Run: semToTestT :: Monad m => Member (Embed m) r => (forall x. Sem r x -> m x) -> Sem (Fail : (Error TestError : (Hedgehog m : (Error Failure : r)))) a -> TestT m a
- Polysemy.Test.Run: semToTestTFinal :: Monad m => Sem [Fail, Error TestError, Hedgehog m, Embed m, Final m] a -> TestT m a
+ Polysemy.Test.Run: semToTestTFinal :: Monad m => Sem [Fail, Error TestError, Hedgehog m, Error Failure, Embed m, Final m] a -> TestT m a
- Polysemy.Test.Run: unwrapLiftedTestT :: forall m r a. Monad m => Member (Embed m) r => Sem (Fail : (Error TestError : (Hedgehog m : r))) a -> Sem r (Journal, Either Failure a)
+ Polysemy.Test.Run: unwrapLiftedTestT :: forall m r a. Monad m => Member (Embed m) r => Sem (Fail : (Error TestError : (Hedgehog m : (Error Failure : r)))) a -> Sem r (Journal, Either Failure a)
Files
- changelog.md +4/−0
- lib/Polysemy/Test/Run.hs +7/−6
- polysemy-test.cabal +24/−8
- test/Polysemy/Test/Test/HedgehogTest.hs +3/−3
changelog.md view
@@ -1,3 +1,7 @@+# 0.6.0.0++* Expose the `Error Failure` effect in the hedgehog interpret stack to allow throwing `Failure` manually.+ # 0.3.1.0 * Add Hedgehog assertion combinators for the difference between numeric values.
lib/Polysemy/Test/Run.hs view
@@ -119,13 +119,13 @@ ∀ m r a . Monad m => Member (Embed m) r =>- Sem (Fail : Error TestError : Hedgehog m : r) a ->+ Sem (Fail : Error TestError : Hedgehog m : Error Failure : r) a -> Sem r (Journal, Either Failure a) unwrapLiftedTestT = runWriter . runError . rewriteHedgehog .- raiseUnder2 .+ raise2Under . (>>= errorToFailure @m) . runError . failToFailure@@ -135,7 +135,7 @@ Monad m => Member (Embed m) r => (∀ x . Sem r x -> m x) ->- Sem (Fail : Error TestError : Hedgehog m : r) a ->+ Sem (Fail : Error TestError : Hedgehog m : Error Failure : r) a -> TestT m a semToTestT runSem sem = do (journal, result) <- lift (runSem (unwrapLiftedTestT sem))@@ -144,7 +144,7 @@ -- |'Final' version of 'semToTestT'. semToTestTFinal :: Monad m =>- Sem [Fail, Error TestError, Hedgehog m, Embed m, Final m] a ->+ Sem [Fail, Error TestError, Hedgehog m, Error Failure, Embed m, Final m] a -> TestT m a semToTestTFinal = semToTestT (runFinal . embedToFinal)@@ -156,6 +156,7 @@ Fail, Error TestError, Hedgehog IO,+ Error Failure, Embed IO, Final IO ]@@ -207,7 +208,7 @@ HasCallStack => Members [Resource, Embed IO] r => (∀ x . Sem r x -> IO x) ->- Sem (Test : Fail : Error TestError : Hedgehog IO : r) a ->+ Sem (Test : Fail : Error TestError : Hedgehog IO : Error Failure : r) a -> TestT IO a runTestAutoWith runSem sem = semToTestT runSem do@@ -217,7 +218,7 @@ -- |Version of 'runTestAutoWith' specialized to @'Final' IO@ runTestAuto :: HasCallStack =>- Sem [Test, Fail, Error TestError, Hedgehog IO, Embed IO, Resource, Final IO] a ->+ Sem [Test, Fail, Error TestError, Hedgehog IO, Error Failure, Embed IO, Resource, Final IO] a -> TestT IO a runTestAuto = runTestAutoWith (runFinal . resourceToIOFinal . embedToFinal)
polysemy-test.cabal view
@@ -5,12 +5,14 @@ -- see: https://github.com/sol/hpack name: polysemy-test-version: 0.5.0.0+version: 0.6.0.0 synopsis: Polysemy Effects for Testing description: See https://hackage.haskell.org/package/polysemy-test/docs/Polysemy-Test.html category: Test+homepage: https://github.com/tek/polysemy-test#readme+bug-reports: https://github.com/tek/polysemy-test/issues author: Torsten Schmits-maintainer: haskell@tryp.io+maintainer: hackage@tryp.io copyright: 2022 Torsten Schmits license: BSD-2-Clause-Patent license-file: LICENSE@@ -21,6 +23,10 @@ data-files: test/fixtures/files/file1 +source-repository head+ type: git+ location: https://github.com/tek/polysemy-test+ library exposed-modules: Polysemy.Test@@ -46,8 +52,10 @@ DeriveFoldable DeriveFunctor DeriveGeneric+ DeriveLift DeriveTraversable DerivingStrategies+ DerivingVia DisambiguateRecordFields DoAndIfThenElse DuplicateRecordFields@@ -77,6 +85,7 @@ RankNTypes RecordWildCards RecursiveDo+ RoleAnnotations ScopedTypeVariables StandaloneDeriving TemplateHaskell@@ -93,7 +102,7 @@ build-depends: base >=4.12 && <5 , hedgehog >=1.0.2- , incipit-core >=0.2+ , incipit-core >=0.3 , path >=0.7 , path-io >=0.2 , polysemy >=1.3@@ -102,6 +111,8 @@ , transformers mixins: base hiding (Prelude)+ , incipit-core (IncipitCore as Prelude)+ , incipit-core hiding (IncipitCore) default-language: Haskell2010 test-suite polysemy-test-unit@@ -126,8 +137,10 @@ DeriveFoldable DeriveFunctor DeriveGeneric+ DeriveLift DeriveTraversable DerivingStrategies+ DerivingVia DisambiguateRecordFields DoAndIfThenElse DuplicateRecordFields@@ -157,6 +170,7 @@ RankNTypes RecordWildCards RecursiveDo+ RoleAnnotations ScopedTypeVariables StandaloneDeriving TemplateHaskell@@ -172,12 +186,14 @@ ghc-options: -Wall -Wredundant-constraints -Wunused-packages -threaded -rtsopts -with-rtsopts=-N build-depends: base >=4.12 && <5- , hedgehog- , incipit-core- , path- , polysemy+ , hedgehog >=1.0.2+ , incipit-core >=0.3+ , path >=0.7+ , polysemy >=1.3 , polysemy-test- , tasty+ , tasty >=1.1 mixins: base hiding (Prelude)+ , incipit-core (IncipitCore as Prelude)+ , incipit-core hiding (IncipitCore) default-language: Haskell2010
test/Polysemy/Test/Test/HedgehogTest.hs view
@@ -15,7 +15,7 @@ semToTestTFinal ((/==) @_ @IO (1 :: Int) 2) hedgehogTest ::- Sem [Test, Fail, Error TestError, Hedgehog IO, Embed IO, Resource, Final IO] () ->+ Sem [Test, Fail, Error TestError, Hedgehog IO, Error Failure, Embed IO, Resource, Final IO] () -> TestT IO Bool hedgehogTest prog = extract . fst <$> liftIO (runTestT (runTestAuto prog))@@ -27,13 +27,13 @@ True hedgehogSuccess ::- Sem [Test, Fail, Error TestError, Hedgehog IO, Embed IO, Resource, Final IO] () ->+ Sem [Test, Fail, Error TestError, Hedgehog IO, Error Failure, Embed IO, Resource, Final IO] () -> UnitTest hedgehogSuccess = assert <=< hedgehogTest hedgehogFail ::- Sem [Test, Fail, Error TestError, Hedgehog IO, Embed IO, Resource, Final IO] () ->+ Sem [Test, Fail, Error TestError, Hedgehog IO, Error Failure, Embed IO, Resource, Final IO] () -> UnitTest hedgehogFail = assert . not <=< hedgehogTest