resourcet 1.1.7.3 → 1.1.7.4
raw patch · 3 files changed
+33/−28 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.Monad.Trans.Resource: throwM :: (MonadThrow m, Exception e) => e -> m a
+ Control.Monad.Trans.Resource: throwM :: Exception e => e -> m a
Files
- ChangeLog.md +4/−0
- resourcet.cabal +1/−1
- test/main.hs +28/−27
ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.1.7.4++* Make test suite slightly more robust+ ## 1.1.7.3 * Doc tweak
resourcet.cabal view
@@ -1,5 +1,5 @@ Name: resourcet-Version: 1.1.7.3+Version: 1.1.7.4 Synopsis: Deterministic allocation and freeing of scarce resources. description: Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/resourcet>. License: BSD3
test/main.hs view
@@ -32,9 +32,34 @@ runResourceT $ release key y <- liftIO $ readIORef x liftIO $ y `shouldBe` 1- describe "forking" $ do- forkHelper "resourceForkIO" resourceForkIO- --forkHelper "lifted fork" fork+ describe "resourceForkIO" $ do+ it "waits for all threads" $ do+ x <- newEmptyMVar+ y <- newIORef 0+ z <- newEmptyMVar+ w <- newEmptyMVar++ runResourceT $ do+ _ <- register $ do+ writeIORef y 1+ putMVar w ()+ resourceForkIO $ do+ () <- liftIO $ takeMVar x+ y' <- liftIO $ readIORef y+ _ <- register $ putMVar z y'+ return ()++ y1 <- readIORef y+ y1 `shouldBe` 0++ putMVar x ()++ z' <- takeMVar z+ z' `shouldBe` 0++ takeMVar w+ y2 <- readIORef y+ Just y2 `shouldBe` Just 1 describe "unprotecting" $ do it "unprotect keeps resource from being cleared" $ do x <- newIORef 0@@ -104,27 +129,3 @@ data Dummy = Dummy deriving (Show, Typeable) instance Exception Dummy--forkHelper s fork' = describe s $ do- it "waits for all threads" $ do- x <- newEmptyMVar- y <- newIORef 0- z <- newEmptyMVar- runResourceT $ do- _ <- register $ writeIORef y 1- fork' $ do- () <- liftIO $ takeMVar x- y' <- liftIO $ readIORef y- _ <- register $ putMVar z y'- return ()-- y1 <- readIORef y- y1 `shouldBe` 0-- putMVar x ()-- z' <- takeMVar z- z' `shouldBe` 0-- y2 <- readIORef y- Just y2 `shouldBe` Just 1