test for Cabal and CabalApi.

This commit is contained in:
Kazu Yamamoto
2013-02-12 16:24:33 +09:00
parent 23045b5312
commit 5b2ddde59e
7 changed files with 165 additions and 13 deletions

View File

@@ -1,8 +1,15 @@
module Expectation where
import Test.Hspec
import System.Directory
import Control.Exception as E
shouldContain :: Eq a => [a] -> a -> Expectation
shouldContain containers element = do
let res = element `elem` containers
res `shouldBe` True
withDirectory :: FilePath -> IO a -> IO a
withDirectory dir action = bracket getCurrentDirectory
setCurrentDirectory
(\_ -> setCurrentDirectory dir >> action)