1 import Test
.Cabal
.Prelude
2 import Data
.List
( isInfixOf
, groupBy )
3 import Data
.Function
( on
)
6 workdir
<- fmap testWorkDir getTestEnv
7 let conf
= workdir
</> "cabal-config"
8 cabalG
["--config-file", conf
] "user-config" ["init"]
9 confContents
<- liftIO
$ readFile conf
10 let ls
= lines confContents
11 sections
= groupBy ((==) `on`
(== "")) ls
12 [initLs
] = filter ((== "init") . head) sections
14 assertInitSectionContainsField
init "quiet"
15 assertInitSectionContainsField
init "no-comments"
16 assertInitSectionContainsField
init "minimal"
17 assertInitSectionContainsField
init "simple"
19 assertInitSectionContainsField section field
=
20 assertBool
("init section of config should contain the field " ++ field
)
21 ((field
++ ":") `isInfixOf` section
)