mirror of
https://github.com/composewell/streamly.git
synced 2024-09-11 11:37:22 +03:00
Add some simple tests
This commit is contained in:
parent
c49732a7a6
commit
11c1f14755
10
test/Main.hs
10
test/Main.hs
@ -11,8 +11,18 @@ default (Int)
|
||||
|
||||
main :: IO ()
|
||||
main = hspec $ do
|
||||
it "simple wait_" $
|
||||
wait_ (return 0) `shouldReturn` ()
|
||||
it "simple wait_ with IO" $
|
||||
wait_ (liftIO $ putStrLn "hello") `shouldReturn` ()
|
||||
it "Captures a return value using wait" $
|
||||
wait (return 0) `shouldReturn` ([0] :: [Int])
|
||||
it "simple wait_ and 'then' with IO" $
|
||||
wait_ (liftIO (putStrLn "hello") >> liftIO (putStrLn "world")) `shouldReturn` ()
|
||||
it "Then and wait" $
|
||||
wait (return 1 >> return 2) `shouldReturn` ([2] :: [Int])
|
||||
it "Bind and wait" $
|
||||
wait (do x <- return 1; y <- return 2; return (x + y)) `shouldReturn` ([3] :: [Int])
|
||||
it "Alternative composition of sync tasks" $
|
||||
((wait $ threads 0 $ (return 0 <|> return 1)) >>= return . sort) `shouldReturn` ([0, 1] :: [Int])
|
||||
it "Alternative composition of async and sync tasks" $
|
||||
|
Loading…
Reference in New Issue
Block a user