error test for Cradle.

This commit is contained in:
Kazu Yamamoto 2013-03-05 10:49:32 +09:00
parent 39954d9114
commit 2a13e9b243

View File

@ -42,7 +42,7 @@ spec = do
}
it "finds a sandbox if exists" $ do
withDirectory "/" $ \dir -> do
withDirectory "/" $ \dir -> do
res <- relativeCradle dir <$> findCradle (Just $ addTrailingPathSeparator dir ++ "test/data/cabal-dev") "7.6.2"
res `shouldBe` Cradle {
cradleCurrentDir = "/"
@ -51,6 +51,10 @@ spec = do
, cradlePackageConf = Just "test/data/cabal-dev/packages-7.6.2.conf"
}
it "throws an error if the sandbox does not exist" $ do
withDirectory_ "/" $
findCradle (Just "/") "7.4.1" `shouldThrow` anyIOException
relativeCradle :: FilePath -> Cradle -> Cradle
relativeCradle dir cradle = Cradle {
cradleCurrentDir = toRelativeDir dir $ cradleCurrentDir cradle