File tree Expand file tree Collapse file tree
cabal-testsuite/PackageTests
ConfigFile/InitSectionFieldsBools Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # cabal user-config
2+ Writing default configuration to <ROOT>/cabal.dist/cabal-config
Original file line number Diff line number Diff line change 1+ import Test.Cabal.Prelude
2+ import Data.List (isInfixOf , groupBy )
3+ import Data.Function (on )
4+
5+ main = cabalTest $ do
6+ workdir <- fmap testWorkDir getTestEnv
7+ let conf = workdir </> " cabal-config"
8+
9+ cabalG [" --config-file" , conf] " user-config" [" init" ]
10+ confContents <- liftIO $ readFile conf
11+
12+ let ls = lines confContents
13+ sections = groupBy ((==) `on` (== " " )) ls
14+ [initLs] = filter ((== " -- full-version: False" ) . head ) sections
15+ init = unlines initLs
16+
17+ assertBool " init section of config should contain debug-info: 0" (" debug-info: 0" `isInfixOf` init )
18+ assertBool " init section of config should contain optimization: 1" (" optimization: 1" `isInfixOf` init )
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ packages: .
22
33build-info : true
44optimization : tRuE
5+ debug-info : fALSe
56
67package test
78 flags : -bar
You can’t perform that action at this time.
0 commit comments