diff --git a/test/Quasar/AsyncSpec.hs b/test/Quasar/AsyncSpec.hs index fd5a614befc770ed0485f1351f2b6a485466f5a9..625e2c4e3bb2e31781f6912f3259fa614c8baab2 100644 --- a/test/Quasar/AsyncSpec.hs +++ b/test/Quasar/AsyncSpec.hs @@ -5,34 +5,35 @@ import Control.Monad (void) import Control.Monad.IO.Class import Prelude import Test.Hspec -import Quasar.Async +--import Quasar.Async import Quasar.Awaitable import Quasar.ResourceManager import System.Timeout spec :: Spec -spec = parallel $ do - describe "async" $ do - it "can pass a value through async and await" $ do - withRootResourceManager (await =<< async (pure 42)) `shouldReturn` (42 :: Int) - - it "can pass a value through async and await" $ do - withRootResourceManager (await =<< async (liftIO (threadDelay 100000) >> pure 42)) `shouldReturn` (42 :: Int) - - describe "await" $ do - it "can await the result of an async that is completed later" $ do - avar <- newAsyncVar :: IO (AsyncVar ()) - void $ forkIO $ do - threadDelay 100000 - putAsyncVar_ avar () - await avar - - it "can fmap the result of an already finished async" $ do - await (pure () :: Awaitable ()) :: IO () - - it "can terminate when encountering an asynchronous exception" $ do - never <- newAsyncVar :: IO (AsyncVar ()) - - result <- timeout 100000 $ withRootResourceManager $ - await never - result `shouldBe` Nothing +spec = describe "async" $ it "async" $ pendingWith "moving to new implementation..." +--spec = parallel $ do +-- describe "async" $ do +-- it "can pass a value through async and await" $ do +-- withRootResourceManager (await =<< async (pure 42)) `shouldReturn` (42 :: Int) +-- +-- it "can pass a value through async and await" $ do +-- withRootResourceManager (await =<< async (liftIO (threadDelay 100000) >> pure 42)) `shouldReturn` (42 :: Int) +-- +-- describe "await" $ do +-- it "can await the result of an async that is completed later" $ do +-- avar <- newAsyncVar :: IO (AsyncVar ()) +-- void $ forkIO $ do +-- threadDelay 100000 +-- putAsyncVar_ avar () +-- await avar +-- +-- it "can fmap the result of an already finished async" $ do +-- await (pure () :: Awaitable ()) :: IO () +-- +-- it "can terminate when encountering an asynchronous exception" $ do +-- never <- newAsyncVar :: IO (AsyncVar ()) +-- +-- result <- timeout 100000 $ withRootResourceManager $ +-- await never +-- result `shouldBe` Nothing