Merge pull request #10709 from Kleidukos/cabal-3.14.1.1-release-notes
[cabal.git] / cabal-install / tests / UnitTests / Distribution / Client / Init / FileCreators.hs
blob63a5774acb18f58fc7583dede55b9dd78169d99e
1 {-# LANGUAGE OverloadedLists #-}
2 {-# LANGUAGE OverloadedStrings #-}
4 module UnitTests.Distribution.Client.Init.FileCreators
5 ( tests
6 ) where
8 import Test.Tasty
9 import Test.Tasty.HUnit
11 import UnitTests.Distribution.Client.Init.Utils
13 import Distribution.Client.Init.FileCreators
14 import Distribution.Client.Init.NonInteractive.Command
15 import Distribution.Client.Init.Types
16 import Distribution.Client.Types
17 import Distribution.Simple
18 import Distribution.Simple.Flag
19 import Distribution.Simple.PackageIndex
20 import Distribution.Verbosity
22 tests
23 :: Verbosity
24 -> InitFlags
25 -> Compiler
26 -> InstalledPackageIndex
27 -> SourcePackageDb
28 -> TestTree
29 tests _v _initFlags comp pkgIx srcDb =
30 testGroup
31 "Distribution.Client.Init.FileCreators"
32 [ testCase "Check . as source directory" $ do
33 let dummyFlags' =
34 dummyFlags
35 { packageType = Flag LibraryAndExecutable
36 , minimal = Flag False
37 , overwrite = Flag False
38 , packageDir = Flag "/home/test/test-package"
39 , extraDoc = Flag ["CHANGELOG.md"]
40 , exposedModules = Flag []
41 , otherModules = Flag []
42 , otherExts = Flag []
43 , buildTools = Flag []
44 , mainIs = Flag "quxApp/Main.hs"
45 , dependencies = Flag []
46 , sourceDirs = Flag ["."]
48 inputs =
49 -- createProject stuff
50 [ "Foobar"
51 , "foobar@qux.com"
52 , "True"
53 , "[\"quxTest/Main.hs\"]"
54 , -- writeProject stuff
55 -- writeLicense
56 "2021"
57 , -- writeFileSafe
58 "True"
59 , -- findNewPath
60 "False"
61 , -- writeChangeLog
62 -- writeFileSafe
63 "False"
64 , -- prepareLibTarget
65 -- writeDirectoriesSafe
66 "True"
67 , -- findNewPath
68 "False"
69 , -- prepareExeTarget
70 -- writeDirectoriesSafe
71 "False"
72 , -- writeFileSafe
73 "False"
74 , -- prepareTestTarget
75 -- writeDirectoriesSafe
76 "False"
77 , -- writeFileSafe
78 "False"
79 , -- writeCabalFile
80 -- writeFileSafe
81 "False"
84 case flip runPrompt inputs $ do
85 projSettings <- createProject comp silent pkgIx srcDb dummyFlags'
86 writeProject projSettings of
87 Left (BreakException ex) -> assertFailure $ show ex
88 Right _ -> return ()