Merge pull request #10525 from 9999years/field-stanza-names
[cabal.git] / cabal-install / tests / UnitTests / Distribution / Client / Init.hs
blobce33e9ab3026d58263fb5debccb41ca1fe536f23
1 module UnitTests.Distribution.Client.Init
2 ( tests
3 ) where
5 import Test.Tasty
7 import qualified UnitTests.Distribution.Client.Init.FileCreators as FileCreators
8 import qualified UnitTests.Distribution.Client.Init.Golden as Golden
9 import qualified UnitTests.Distribution.Client.Init.Interactive as Interactive
10 import qualified UnitTests.Distribution.Client.Init.NonInteractive as NonInteractive
11 import qualified UnitTests.Distribution.Client.Init.Simple as Simple
13 import UnitTests.Distribution.Client.Init.Utils
15 import Distribution.Client.Config
16 import Distribution.Client.IndexUtils
17 import Distribution.Client.Init.Types
18 import Distribution.Client.Sandbox
19 import Distribution.Client.Setup
20 import Distribution.Simple.Compiler
21 import Distribution.Verbosity
23 tests :: IO [TestTree]
24 tests = do
25 confFlags <- loadConfigOrSandboxConfig v defaultGlobalFlags
27 let confFlags' = savedConfigureFlags confFlags `mappend` compFlags
28 initFlags' = savedInitFlags confFlags `mappend` emptyFlags
29 globalFlags' = savedGlobalFlags confFlags `mappend` defaultGlobalFlags
31 (comp, _, progdb) <- configCompilerAux' confFlags'
33 withRepoContext v globalFlags' $ \repoCtx -> do
34 let pkgDb = configPackageDB' confFlags'
36 pkgIx <- getInstalledPackages v comp (interpretPackageDBStack Nothing pkgDb) progdb
37 srcDb <- getSourcePackages v repoCtx
39 return
40 [ Interactive.tests v initFlags' pkgIx srcDb
41 , NonInteractive.tests v initFlags' comp pkgIx srcDb
42 , Golden.tests v initFlags' pkgIx srcDb
43 , Simple.tests v initFlags' pkgIx srcDb
44 , FileCreators.tests v initFlags' comp pkgIx srcDb
46 where
47 v :: Verbosity
48 v = normal
50 compFlags :: ConfigFlags
51 compFlags = mempty{configHcPath = initHcPath emptyFlags}