Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 67 additions & 72 deletions cabal-install/src/Distribution/Client/Init/Format.hs
Original file line number Diff line number Diff line change
Expand Up @@ -314,80 +314,75 @@ mkExeStanza opts (ExeTarget exeMain appDirs lang otherMods exts deps tools) =

mkTestStanza :: WriteOpts -> TestTarget -> PrettyField FieldAnnotation
mkTestStanza opts (TestTarget testMain dirs lang otherMods exts deps tools) =
PrettySection
annNoComments
(toUTF8BS "test-suite")
[suiteName]
( insertCommonStanzas opts
++ insertRtsOptionsStanza opts
++ [ case specHasCommonStanzas $ _optCabalSpec opts of
NoCommonStanzas -> PrettyEmpty
_ ->
field
"import"
(hsep . map text)
["warnings"]
["Import common warning flags."]
let commonSections =
case specHasCommonStanzas $ _optCabalSpec opts of
NoCommonStanzas -> [PrettyEmpty]
_ ->
insertCommonStanzas opts
++ insertRtsOptionsStanza opts
in PrettySection
annNoComments
(toUTF8BS "test-suite")
[suiteName]
( commonSections
++ [ field
"default-language"
id
lang
["Base language which the package is written in."]
True
opts
, field
"other-modules"
formatOtherModules
otherMods
["Modules included in this executable, other than Main."]
True
opts
, field
"other-extensions"
formatOtherExtensions
exts
["LANGUAGE extensions used by modules in this package."]
True
opts
, field
"type"
text
"exitcode-stdio-1.0"
["The interface type and version of the test suite."]
True
opts
, field
"hs-source-dirs"
formatHsSourceDirs
(makeSymbolicPath <$> dirs)
["Directories containing source files."]
True
opts
, field
"main-is"
unsafeFromHs
testMain
["The entrypoint to the test suite."]
True
opts
, field
"build-depends"
formatDependencyList
deps
["Test dependencies."]
True
opts
, field
(buildToolTag opts)
formatDependencyList
tools
["Extra tools (e.g. alex, hsc2hs, ...) needed to build the source."]
False
opts
, field
"default-language"
id
lang
["Base language which the package is written in."]
True
opts
, field
"other-modules"
formatOtherModules
otherMods
["Modules included in this executable, other than Main."]
True
opts
, field
"other-extensions"
formatOtherExtensions
exts
["LANGUAGE extensions used by modules in this package."]
True
opts
, field
"type"
text
"exitcode-stdio-1.0"
["The interface type and version of the test suite."]
True
opts
, field
"hs-source-dirs"
formatHsSourceDirs
(makeSymbolicPath <$> dirs)
["Directories containing source files."]
True
opts
, field
"main-is"
unsafeFromHs
testMain
["The entrypoint to the test suite."]
True
opts
, field
"build-depends"
formatDependencyList
deps
["Test dependencies."]
True
opts
, field
(buildToolTag opts)
formatDependencyList
tools
["Extra tools (e.g. alex, hsc2hs, ...) needed to build the source."]
False
opts
]
)
]
)
where
suiteName = text $ unPackageName (_optPkgName opts) ++ "-test"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ test-suite y-test
import: extensions
import: ghc-options
import: rts-options
import: warnings
default-language: Haskell2010
-- other-modules:
-- other-extensions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ test-suite y-test
-- Common RTS options
import: rts-options

-- Import common warning flags.
import: warnings

-- Base language which the package is written in.
default-language: Haskell2010

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ test-suite y-test
import: extensions
import: ghc-options
import: rts-options
import: warnings
default-language: Haskell2010
-- other-modules:
-- other-extensions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ test-suite y-test
-- Common RTS options
import: rts-options

-- Import common warning flags.
import: warnings

-- Base language which the package is written in.
default-language: Haskell2010

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ test-suite y-test
import: extensions
import: ghc-options
import: rts-options
import: warnings
default-language: Haskell2010
-- other-modules:
-- other-extensions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ test-suite y-test
-- Common RTS options
import: rts-options

-- Import common warning flags.
import: warnings

-- Base language which the package is written in.
default-language: Haskell2010

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ test-suite y-test
import: extensions
import: ghc-options
import: rts-options
import: warnings
default-language: Haskell2010
-- other-modules:
-- other-extensions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ test-suite y-test
-- Common RTS options
import: rts-options

-- Import common warning flags.
import: warnings

-- Base language which the package is written in.
default-language: Haskell2010

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ test-suite y-test
-- Common RTS options
import: rts-options

-- Import common warning flags.
import: warnings

-- Base language which the package is written in.
default-language: Haskell2010

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ test-suite y-test
import: extensions
import: ghc-options
import: rts-options
import: warnings
default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ test-suite y-test
import: extensions
import: ghc-options
import: rts-options
import: warnings
default-language: Haskell2010
-- other-modules:
-- other-extensions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ test-suite y-test
import: extensions
import: ghc-options
import: rts-options
import: warnings
default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ test-suite y-test
-- Common RTS options
import: rts-options

-- Import common warning flags.
import: warnings

-- Base language which the package is written in.
default-language: Haskell2010

Expand Down
Loading