Preserve cabal flags when reconfiguring project

This commit is contained in:
Daniel Gröber
2015-09-24 05:27:20 +02:00
parent 2549bba7b8
commit 19b3de3569
2 changed files with 40 additions and 12 deletions

View File

@@ -70,12 +70,25 @@ spec = do
pkgs = pkgOptions ghcOpts
pkgs `shouldBe` ["Cabal","base","template-haskell"]
it "uses non default flags" $ do
it "uses non default flags and preserves them across reconfigures" $ do
let tdir = "test/data/cabal-flags"
_ <- withDirectory_ tdir $
readProcess "cabal" ["configure", "-ftest-flag"] ""
opts <- map gmcGhcOpts <$> runD' tdir getComponents
let ghcOpts = head opts
pkgs = pkgOptions ghcOpts
pkgs `shouldBe` ["Cabal","base"]
let test = do
opts <- map gmcGhcOpts <$> runD' tdir getComponents
let ghcOpts = head opts
pkgs = pkgOptions ghcOpts
pkgs `shouldBe` ["Cabal","base"]
test
touch $ tdir </> "cabal-flags.cabal"
test
touch :: FilePath -> IO ()
touch fn = do
f <- readFile fn
writeFile (fn <.> "tmp") f
renameFile (fn <.> "tmp") fn