more tests.

This commit is contained in:
Kazu Yamamoto 2013-09-21 15:32:22 +09:00
parent c78d708c1c
commit 1050ea3c63
4 changed files with 20 additions and 6 deletions

View File

@ -28,14 +28,17 @@ Extra-Source-Files: ChangeLog
test/data/*.hs
test/data/cabal.sandbox.config
test/data/.cabal-sandbox/i386-osx-ghc-7.6.3-packages.conf.d/dummy
test/data/ghc-mod-check/*.hs
test/data/ghc-mod-check/*.cabal
test/data/ghc-mod-check/Data/*.hs
test/data/subdir1/subdir2/dummy
test/data/broken-cabal/*.cabal
test/data/broken-sandbox/*.cabal
test/data/broken-sandbox/cabal.sandbox.config
test/data/check-test-subdir/*.cabal
test/data/check-test-subdir/src/Check/Test/*.hs
test/data/check-test-subdir/test/*.hs
test/data/check-test-subdir/test/Bar/*.hs
test/data/check-test-subdir/src/Check/Test/*.hs
test/data/ghc-mod-check/*.cabal
test/data/ghc-mod-check/*.hs
test/data/ghc-mod-check/Data/*.hs
test/data/subdir1/subdir2/dummy
Library
Default-Language: Haskell2010

View File

@ -22,7 +22,6 @@ spec = do
, cradleCabalFile = Nothing
, cradlePackageDbOpts = []
}
it "finds a cabal file and a sandbox" $ do
withDirectory "test/data/subdir1/subdir2" $ \dir -> do
res <- relativeCradle dir <$> findCradle
@ -32,6 +31,16 @@ spec = do
, cradleCabalFile = Just ("test" </> "data" </> "cabalapi.cabal")
, cradlePackageDbOpts = ["-no-user-package-db", "-package-db", "test" </> "data" </> ".cabal-sandbox" </> "i386-osx-ghc-7.6.3-packages.conf.d"]
}
it "works even if a sandbox config file is broken" $ do
withDirectory "test/data/broken-sandbox" $ \dir -> do
res <- relativeCradle dir <$> findCradle
res `shouldBe` Cradle {
cradleCurrentDir = "test" </> "data" </> "broken-sandbox"
, cradleCabalDir = Just ("test" </> "data" </> "broken-sandbox")
, cradleCabalFile = Just ("test" </> "data" </> "broken-sandbox" </> "dummy.cabal")
, cradlePackageDbOpts = []
}
describe "getPackageDbDir" $ do
it "parses a config file and extracts package db" $ do
pkgDb <- getPackageDbDir "test/data/cabal.sandbox.config"

View File

@ -0,0 +1 @@
broken

View File

@ -0,0 +1 @@
dummy