[英]Hspec deal with two IO actions in Haskell
我的問題是在Haskell的HSpec中是否有方法可以測試兩個IO actions
?
就像下面的示例一樣:(以下由於類型錯誤)
it "parse examples 0" $ liftM2 shouldBe (tests "ex0in.txt") (tests "ex0Out.txt")
tests :: FileType -> IO (Either String String)
我不知道FileType
,我認為它等於FilePath
。
it "parse examples 0" $ do
ex0in <- liftIO (tests "ex0in.txt")
ex0out <- liftIO (tests "ex0Out.txt")
ex0in `shouldBe` ex0out
it "parse examples 0" $ join $ liftM2 shouldBe (liftIO (tests "ex0in.txt")) (liftIO (tests "ex0Out.txt"))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.