-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8839 from ulysses4ever/t8835-init-config
Allow no-comments, quiet, simple, minimal in init section of config
- Loading branch information
Showing
4 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
cabal-testsuite/PackageTests/ConfigFile/InitSectionFields/cabal.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# cabal user-config | ||
Writing default configuration to <ROOT>/cabal.dist/cabal-config |
21 changes: 21 additions & 0 deletions
21
cabal-testsuite/PackageTests/ConfigFile/InitSectionFields/cabal.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Test.Cabal.Prelude | ||
import Data.List ( isInfixOf, groupBy ) | ||
import Data.Function ( on ) | ||
|
||
main = cabalTest $ do | ||
workdir <- fmap testWorkDir getTestEnv | ||
let conf = workdir </> "cabal-config" | ||
cabalG ["--config-file", conf] "user-config" ["init"] | ||
confContents <- liftIO $ readFile conf | ||
let ls = lines confContents | ||
sections = groupBy ((==) `on` (== "")) ls | ||
[initLs] = filter ((== "init") . head) sections | ||
init = unlines initLs | ||
assertInitSectionContainsField init "quiet" | ||
assertInitSectionContainsField init "no-comments" | ||
assertInitSectionContainsField init "minimal" | ||
assertInitSectionContainsField init "simple" | ||
|
||
assertInitSectionContainsField section field = | ||
assertBool ("init section of config should contain the field " ++ field) | ||
((field ++ ":") `isInfixOf` section) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
synopsis: config file: allow more flags in the init section | ||
packages: cabal-install | ||
prs: #8839 | ||
issues: #8835 | ||
description: The init section of config file now allows the following fields: | ||
`no-comments`, `quiet`, `simple` and `minimal` |