ghc-mod/test/GhcPkgSpec.hs

26 lines
864 B
Haskell
Raw Normal View History

2014-05-09 18:37:15 +00:00
{-# LANGUAGE CPP #-}
module GhcPkgSpec where
import Language.Haskell.GhcMod.GhcPkg
2014-05-09 18:37:15 +00:00
import Language.Haskell.GhcMod.Types
2014-05-04 22:28:03 +00:00
import System.Directory
import System.FilePath ((</>))
import Test.Hspec
spec :: Spec
spec = do
2014-05-09 18:37:15 +00:00
describe "getPackageDbStack" $ do
#if !MIN_VERSION_Cabal(1,18,0)
it "does not include a sandbox with Cabal < 1.18" $ do
cwd <- getCurrentDirectory
getPackageDbStack cwd `shouldReturn` [GlobalDb, UserDb]
#endif
it "parses a config file and extracts sandbox package db" $ do
cwd <- getCurrentDirectory
pkgDb <- getSandboxDb "test/data/"
pkgDb `shouldBe` (cwd </> "test/data/.cabal-sandbox/i386-osx-ghc-7.6.3-packages.conf.d")
it "throws an error if a config file is broken" $ do
getSandboxDb "test/data/broken-sandbox" `shouldThrow` anyException