ghc-mod/test/GhcPkgSpec.hs
Kazu Yamamoto 8561e7b656 To break cyclic import, this patch makes GhcPkg.hs independent from Monad.hs(refactoring for #244)
This removes `ghcPkgList`, `ghcPkgListEx` and `ghcPkgDbOpt`. I'm not sure
this is a right way to do.
2014-05-08 12:42:45 +09:00

19 lines
593 B
Haskell

module GhcPkgSpec where
import Language.Haskell.GhcMod.GhcPkg
import System.Directory
import System.FilePath ((</>))
import Test.Hspec
spec :: Spec
spec = do
describe "getSandboxDb" $ do
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