on master help sign in
Add some simple tests
commit11c1f1475574c6f62201bde7ff9d8c923458b509 authorHarendra Kumar <harendra.kumar@gmail.com> dateMon 7 Aug 2017, 15:14 (9 years ago) parentc49732a
1 file changed+10
test/Main.hs+10
test/Main.hs+10
@@ -11,8 +11,18 @@ default (Int)
1111
1212main :: IO ()
1313main = hspec $ do
14+ it "simple wait_" $
15+ wait_ (return 0) `shouldReturn` ()
16+ it "simple wait_ with IO" $
17+ wait_ (liftIO $ putStrLn "hello") `shouldReturn` ()
1418 it "Captures a return value using wait" $
1519 wait (return 0) `shouldReturn` ([0] :: [Int])
20+ it "simple wait_ and 'then' with IO" $
21+ wait_ (liftIO (putStrLn "hello") >> liftIO (putStrLn "world")) `shouldReturn` ()
22+ it "Then and wait" $
23+ wait (return 1 >> return 2) `shouldReturn` ([2] :: [Int])
24+ it "Bind and wait" $
25+ wait (do x <- return 1; y <- return 2; return (x + y)) `shouldReturn` ([3] :: [Int])
1626 it "Alternative composition of sync tasks" $
1727 ((wait $ threads 0 $ (return 0 <|> return 1)) >>= return . sort) `shouldReturn` ([0, 1] :: [Int])
1828 it "Alternative composition of async and sync tasks" $