Skip to content

Commit 7954c10

Browse files
committed
Code formatting and comments
1 parent 5866938 commit 7954c10

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

cabal-install/src/Distribution/Client/Init/Interactive/Command.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ createProject v pkgIx srcDb initFlags = do
139139
(Just exeTarget) testTarget
140140

141141
TestSuite -> do
142+
-- the line below is necessary because if both package type and test flags
143+
-- are *not* passed, the user will be prompted for a package type (which
144+
-- includes TestSuite in the list). It prevents that the user end up with a
145+
-- TestSuite target with initializeTestSuite set to NoFlag, thus avoiding the prompt.
142146
let initFlags' = initFlags { initializeTestSuite = Flag True }
143147
testTarget <- genTestTarget initFlags' pkgIx
144148

cabal-install/tests/UnitTests/Distribution/Client/Init/NonInteractive.hs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ driverFunctionTest pkgIx srcDb comp = testGroup "createProject"
320320
, "[\"test/Main.hs\", \"test/Foo.hs\", \"test/bar.y\"]"
321321
]
322322

323-
case (_runPrompt $ createProject comp silent pkgIx srcDb (emptyFlags {initializeTestSuite = Flag True, packageType = Flag LibraryAndExecutable })) inputs of
323+
case (_runPrompt $ createProject comp silent pkgIx srcDb (emptyFlags
324+
{ initializeTestSuite = Flag True
325+
, packageType = Flag LibraryAndExecutable
326+
})) inputs of
324327
Right (ProjectSettings opts desc (Just lib) (Just exe) (Just test), _) -> do
325328
_optOverwrite opts @?= False
326329
_optMinimal opts @?= False
@@ -456,7 +459,10 @@ driverFunctionTest pkgIx srcDb comp = testGroup "createProject"
456459
, "[\"test/Main.hs\", \"test/Foo.hs\", \"test/bar.y\"]"
457460
]
458461

459-
case (_runPrompt $ createProject comp silent pkgIx srcDb (emptyFlags {initializeTestSuite = Flag True, packageType = Flag Library})) inputs of
462+
case (_runPrompt $ createProject comp silent pkgIx srcDb (emptyFlags
463+
{ initializeTestSuite = Flag True
464+
, packageType = Flag Library
465+
})) inputs of
460466
Right (ProjectSettings opts desc (Just lib) Nothing (Just test), _) -> do
461467
_optOverwrite opts @?= False
462468
_optMinimal opts @?= False

0 commit comments

Comments
 (0)