Skip to content

Commit

Permalink
error test for Cradle.
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Mar 5, 2013
1 parent 39954d9 commit 2a13e9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/CradleSpec.hs
Expand Up @@ -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 = "/"
Expand All @@ -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
Expand Down

0 comments on commit 2a13e9b

Please sign in to comment.