packages feed

polysemy-test 0.3.1.0 → 0.3.1.1

raw patch · 13 files changed

+99/−98 lines, 13 filesdep ~pathdep ~path-iodep ~reludePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: path, path-io, relude, tasty, tasty-hedgehog

API changes (from Hackage documentation)

- Polysemy.Test: assertClose :: forall a m r. Num a => Ord a => Fractional a => Show a => Monad m => HasCallStack => Member (Hedgehog m) r => a -> a -> Sem r ()
+ Polysemy.Test: assertClose :: forall a m r. Ord a => Fractional a => Monad m => HasCallStack => Member (Hedgehog m) r => a -> a -> Sem r ()
- Polysemy.Test: assertCloseBy :: forall a m r. Num a => Ord a => Show a => Monad m => HasCallStack => Member (Hedgehog m) r => a -> a -> a -> Sem r ()
+ Polysemy.Test: assertCloseBy :: forall a m r. Num a => Ord a => Monad m => HasCallStack => Member (Hedgehog m) r => a -> a -> a -> Sem r ()

Files

− Changelog.md
@@ -1,14 +0,0 @@-# 0.3.1.0--* Add Hedgehog assertion combinators for the difference between numeric values.-* Add `assertEq` / `assertNeq` as prefix synonyms for `(===)` / `(/==)`.--# 0.3.0.0--* Add type parameter for the monad used by `TestT` to `Hedgehog`-* Interpret `Hedgehog` with Polysemy counterparts to `TestT`'s monad stack.-* Add `evalError`, which converts a Polysemy `Error` effect into an assertion.--# 0.1.0.0--* initial release
− README.md
@@ -1,57 +0,0 @@-# About--This package provides utilities for testing [Polysemy] programs:--* An effect, `Test`, that gives access to temporary files and fixtures-* An effect, `Hedgehog`, for lifted [Hedgehog] assertions--# Example--```haskell-import Path (relfile)-import Polysemy.Test-import Test.Tasty (defaultMain)--test_fixture :: UnitTest-test_fixture =-  runTestAuto do-    fixContent1 <- fixtureLines fixRel-    fixPath <- Test.fixturePath fixRel-    fixContent2 <- Text.lines <$> embed (Text.readFile (toFilePath fixPath))-    fixContent1 === fixContent2-    fixContent1 === ["file", "content"]-  where-    fixRel =-      [relfile|files/file1|]--main :: IO ()-main =-  defaultMain (unitTest test_fixture)-```--# Fixtures--Any file that is located below the subdirectory `fixtures` inside the test-directory can be accessed using the constructors `Test.fixturePath`,-`Test.fixture` and `Text.fixtureLines`.--You can override the path used to look for the `fixtures` directory by using-`runTest` instead of `runTestAuto`.-The latter analyzes the call stack to determine the test directory.--# Temp Files--The constructors `Test.tempDir`, `Test.tempFile`, `Test.tempFileContent` and-`Test.tempFileLines` allow you to create and read files in the `temp` directory-within the test directory.--# Paths--All paths are of type `Path` from the package [path].--You can construct them using the quasiquoters `reldir`, `absdir` etc. or the-functions `parseRelDir`, `parseAbsDir` etc.--[Polysemy]: https://hackage.haskell.org/package/polysemy-[Hedgehog]: https://hackage.haskell.org/package/hedgehog-[path]: https://hackage.haskell.org/package/path
+ changelog.md view
@@ -0,0 +1,14 @@+# 0.3.1.0++* Add Hedgehog assertion combinators for the difference between numeric values.+* Add `assertEq` / `assertNeq` as prefix synonyms for `(===)` / `(/==)`.++# 0.3.0.0++* Add type parameter for the monad used by `TestT` to `Hedgehog`+* Interpret `Hedgehog` with Polysemy counterparts to `TestT`'s monad stack.+* Add `evalError`, which converts a Polysemy `Error` effect into an assertion.++# 0.1.0.0++* initial release
lib/Polysemy/Test/Data/Hedgehog.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_HADDOCK hide #-}+{-# options_haddock hide #-}  module Polysemy.Test.Data.Hedgehog where 
lib/Polysemy/Test/Data/Test.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_HADDOCK hide #-}+{-# options_haddock hide #-}  module Polysemy.Test.Data.Test where 
lib/Polysemy/Test/Data/TestError.hs view
@@ -1,7 +1,8 @@-{-# OPTIONS_HADDOCK hide #-}+{-# options_haddock hide #-}  module Polysemy.Test.Data.TestError where +-- |An error that occured in the test machinery. newtype TestError =   TestError { unTestError :: Text }   deriving (Eq, Show)
lib/Polysemy/Test/Files.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_HADDOCK hide #-}+{-# options_haddock hide #-}  module Polysemy.Test.Files where 
lib/Polysemy/Test/Hedgehog.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_HADDOCK hide #-}+{-# options_haddock hide #-}  module Polysemy.Test.Hedgehog where @@ -252,7 +252,6 @@   ∀ a m r .   Num a =>   Ord a =>-  Show a =>   Monad m =>   HasCallStack =>   Member (Hedgehog m) r =>@@ -266,10 +265,8 @@ -- |Assert that two fractional values are closer to each other than @0.001@. assertClose ::   ∀ a m r .-  Num a =>   Ord a =>   Fractional a =>-  Show a =>   Monad m =>   HasCallStack =>   Member (Hedgehog m) r =>
lib/Polysemy/Test/Prelude.hs view
@@ -1,4 +1,5 @@-{-# OPTIONS_HADDOCK hide #-}+{-# options_haddock hide #-}+{-# options_ghc -Wno-missing-import-lists #-} {-# LANGUAGE NoImplicitPrelude #-}  module Polysemy.Test.Prelude (
lib/Polysemy/Test/Run.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_HADDOCK hide #-}+{-# options_haddock hide #-}  module Polysemy.Test.Run where @@ -63,7 +63,7 @@ -- @/tmp/polysemy-test-XXX@. -- -- This library uses 'Path' for all file system related tasks, so in order to construct paths manually, you'll have to--- use the quasiquoters 'Path.absdir' and 'reldir' or the functions 'parseAbsDir' and 'parseRelDir'.+-- use the quasiquoters 'Path.absdir' and 'Path.reldir' or the functions 'parseAbsDir' and 'parseRelDir'. interpretTestKeepTemp ::   Members [Error TestError, Embed IO] r =>   Path Abs Dir ->@@ -138,6 +138,7 @@   (journal, result) <- lift (run (unwrapLiftedTestT sem))   TestT (ExceptT (result <$ MTL.tell journal)) +-- |'Final' version of 'semToTestT'. semToTestTFinal ::   Monad m =>   Sem [Fail, Error TestError, Hedgehog m, Embed m, Final m] a ->
lib/Prelude.hs view
@@ -1,4 +1,5 @@-{-# OPTIONS_HADDOCK hide #-}+{-# options_haddock hide #-}+{-# options_ghc -Wno-missing-import-lists #-}  module Prelude (   module Polysemy.Test.Prelude,
polysemy-test.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           polysemy-test-version:        0.3.1.0+version:        0.3.1.1 synopsis:       Polysemy effects for testing description:    Please see the README on Github at <https://github.com/tek/polysemy-test> category:       Test@@ -16,8 +16,8 @@ license-file:   LICENSE build-type:     Simple extra-source-files:-    README.md-    Changelog.md+    readme.md+    changelog.md  library   exposed-modules:@@ -29,9 +29,9 @@       Polysemy.Test.Hedgehog       Polysemy.Test.Prelude       Polysemy.Test.Run-      Paths_polysemy_test   other-modules:       Prelude+      Paths_polysemy_test   autogen-modules:       Paths_polysemy_test   hs-source-dirs:@@ -93,20 +93,20 @@       UndecidableInstances       UnicodeSyntax       ViewPatterns-  ghc-options: -Wall -fplugin=Polysemy.Plugin -O2 -flate-specialise -fspecialise-aggressively+  ghc-options: -Wall -fplugin=Polysemy.Plugin   build-depends:       base ==4.*     , containers     , either     , hedgehog >=1.0.2 && <1.1-    , path >=0.7-    , path-io >=0.2+    , path >=0.7 && <0.9+    , path-io >=0.2 && <1.7     , polysemy >=1.3 && <1.6     , polysemy-plugin >=0.2.5-    , relude ==0.7.*+    , relude >=0.7     , string-interpolate >=0.1 && <0.4-    , tasty >=1.2.3 && <1.3-    , tasty-hedgehog >=1 && <1.1+    , tasty >=1.1 && <1.5+    , tasty-hedgehog >=1.0.0.2 && <1.2     , template-haskell     , text     , transformers@@ -180,21 +180,21 @@       UndecidableInstances       UnicodeSyntax       ViewPatterns-  ghc-options: -Wall -fplugin=Polysemy.Plugin -O2 -flate-specialise -fspecialise-aggressively -threaded -rtsopts -with-rtsopts=-N+  ghc-options: -Wall -fplugin=Polysemy.Plugin -threaded -rtsopts -with-rtsopts=-N   build-depends:       base ==4.*     , containers     , either     , hedgehog >=1.0.2 && <1.1-    , path >=0.7-    , path-io >=0.2+    , path >=0.7 && <0.9+    , path-io >=0.2 && <1.7     , polysemy >=1.3 && <1.6     , polysemy-plugin >=0.2.5     , polysemy-test-    , relude ==0.7.*+    , relude >=0.7     , string-interpolate >=0.1 && <0.4     , tasty-    , tasty-hedgehog >=1 && <1.1+    , tasty-hedgehog >=1.0.0.2 && <1.2     , template-haskell     , text     , transformers
+ readme.md view
@@ -0,0 +1,57 @@+# About++This package provides utilities for testing [Polysemy] programs:++* An effect, `Test`, that gives access to temporary files and fixtures+* An effect, `Hedgehog`, for lifted [Hedgehog] assertions++# Example++```haskell+import Path (relfile)+import Polysemy.Test+import Test.Tasty (defaultMain)++test_fixture :: UnitTest+test_fixture =+  runTestAuto do+    fixContent1 <- fixtureLines fixRel+    fixPath <- Test.fixturePath fixRel+    fixContent2 <- Text.lines <$> embed (Text.readFile (toFilePath fixPath))+    fixContent1 === fixContent2+    fixContent1 === ["file", "content"]+  where+    fixRel =+      [relfile|files/file1|]++main :: IO ()+main =+  defaultMain (unitTest test_fixture)+```++# Fixtures++Any file that is located below the subdirectory `fixtures` inside the test+directory can be accessed using the constructors `Test.fixturePath`,+`Test.fixture` and `Text.fixtureLines`.++You can override the path used to look for the `fixtures` directory by using+`runTest` instead of `runTestAuto`.+The latter analyzes the call stack to determine the test directory.++# Temp Files++The constructors `Test.tempDir`, `Test.tempFile`, `Test.tempFileContent` and+`Test.tempFileLines` allow you to create and read files in the `temp` directory+within the test directory.++# Paths++All paths are of type `Path` from the package [path].++You can construct them using the quasiquoters `reldir`, `absdir` etc. or the+functions `parseRelDir`, `parseAbsDir` etc.++[Polysemy]: https://hackage.haskell.org/package/polysemy+[Hedgehog]: https://hackage.haskell.org/package/hedgehog+[path]: https://hackage.haskell.org/package/path