mock-time 0.1.0 → 0.1.1
raw patch · 5 files changed
+25/−11 lines, 5 filesdep +transformersPVP ok
version bump matches the API change (PVP)
Dependencies added: transformers
API changes (from Hackage documentation)
Files
- changelog.md +7/−0
- mock-time.cabal +9/−6
- src/Control/Monad/Time/DefaultInstance.hs +0/−1
- src/Control/Monad/Trans/SimulatedTime.hs +6/−2
- tests/Tests.hs +3/−2
+ changelog.md view
@@ -0,0 +1,7 @@+## 0.1.1 (2024-11-10)++ * Make it compile in ghc 9.6.6++## 0.1.0++ * Initial
mock-time.cabal view
@@ -1,13 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.37.0. -- -- see: https://github.com/sol/hpack------ hash: f70ad4f0d259256d4dd856fc4bce3eb41bb5f2766f36c5baf158d814f0f83acb name: mock-time-version: 0.1.0+version: 0.1.1 synopsis: Mock time in tests description: Allows to mock out Data.Time.getCurrentTime and Control.Concrurent.threadDelay category: Test@@ -17,10 +15,12 @@ copyright: 2020 Kamil Dworakowski license: BSD3 license-file: LICENSE-tested-with: GHC==8.0.1, GHC==8.2.2, GHC==8.8.1, GHC==8.8.3, GHC==8.10.2 build-type: Simple+tested-with:+ GHC == 8.0.2 || ==8.2.2 || ==8.6.5 || ==8.8.3 || ==8.10.2 || ==9.0.1 || ==9.2.1 || ==9.4.8 || ==9.6.6 extra-source-files: README.md+ changelog.md library exposed-modules:@@ -32,6 +32,7 @@ Paths_mock_time hs-source-dirs: src+ ghc-options: -Wall -fno-warn-name-shadowing -fno-warn-orphans build-depends: base >=4.7 && <5 , error-or@@ -41,6 +42,7 @@ , resourcet , stm , time+ , transformers , unliftio-core default-language: Haskell2010 @@ -51,7 +53,7 @@ Paths_mock_time hs-source-dirs: tests- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wno-type-defaults build-depends: QuickCheck , base >=4.7 && <5@@ -68,5 +70,6 @@ , tasty-hunit , tasty-quickcheck , time+ , transformers , unliftio-core default-language: Haskell2010
src/Control/Monad/Time/DefaultInstance.hs view
@@ -7,7 +7,6 @@ -- This is only and instance for IO, for instances for monad transformers see -- 'Control.Monad.Trans.SimulatedTime'. module Control.Monad.Time.DefaultInstance (-module Control.Monad.Time.DefaultInstance, module Control.Monad.Time) where import Control.Monad.Time
src/Control/Monad/Trans/SimulatedTime.hs view
@@ -25,17 +25,21 @@ import Control.Monad.Catch (MonadCatch, MonadMask(..), MonadThrow) import Control.Monad.Cont (MonadCont) import Control.Monad.Except (MonadError)+import Control.Monad (MonadPlus)+import Control.Monad.Fix (MonadFix) import Control.Monad.Primitive (PrimMonad) import Control.Monad.RWS (MonadState, MonadWriter)-import Control.Monad.Reader+import Control.Monad.Reader (MonadReader(..)) import Control.Monad.Time+import Control.Monad.Trans (MonadTrans(lift))+import Control.Monad.Trans.Reader (ReaderT(..), mapReaderT) import Control.Monad.Trans.Resource (MonadResource) import Control.Monad.Zip (MonadZip) import qualified Data.Time import Control.Monad.IO.Unlift import Test.SimulatedTime -#if __GLASGOW_HASKELL__ < 880+#if __GLASGOW_HASKELL__ < 808 import Control.Monad.Fail (MonadFail(..)) #endif
tests/Tests.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} {-# language OverloadedStrings #-}+{-# language TypeApplications #-} import Control.Concurrent (forkIO) import Control.Monad import Data.ErrorOr@@ -13,7 +14,7 @@ import Test.Tasty import Test.Tasty.HUnit import Test.Tasty.QuickCheck-#if __GLASGOW_HASKELL__ < 880+#if __GLASGOW_HASKELL__ < 808 import Data.Semigroup #endif @@ -24,7 +25,7 @@ "tests" [ testCase "put" $ do tenv <- SimTime.create (UTCTime (fromGregorian 2015 7 18) 0)- box <- newInbox+ box <- newInbox @String _ <- forkIO (SimTime.threadDelay' tenv 50000 >> putInbox box "50ms") _ <- forkIO (SimTime.threadDelay' tenv 500000 >> putInbox box ".5s") _ <- forkIO (SimTime.threadDelay' tenv 1000000 >> putInbox box "1s")