@@ -0,0 +1,22 @@
1+module FdCacheSpec where
4+import Network.Wai.Handler.Warp.FdCache
5+import System.Posix.IO (fdRead)
6+import System.Posix.Types (Fd(..))
13+spec = describe "withFdCache" $ do
14+ it "clean up Fd" $ do
15+ ref <- newIORef (Fd (-1))
16+ withFdCache 30000000 $ \(Just mfc) -> do
17+ (fd,_) <- getFd mfc "warp.cabal"
20+ fdRead nfd 1 `shouldThrow` anyIOException