Skip to content

Commit b6b1266

Browse files
committed
small change to not conflict with goldens
1 parent 3a6d592 commit b6b1266

File tree

5 files changed

+216
-7
lines changed

5 files changed

+216
-7
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,18 @@ checkCabalFileGolden flags goldenFileName =
6262

6363
checkInitFlags :: String -> InitFlags -> PackageType -> TestTree
6464
checkInitFlags label flags pkgType = testCase label $ do
65-
flags' <- getLibOrExec rawFlags
66-
>>= getAppDir
67-
>>= getSrcDir
65+
flags' <- getLibOrExec rawFlags
66+
>>= getAppDir
67+
>>= getSrcDir
6868

69-
flags @=? flags'
69+
flags @=? flags'
7070
where
71-
rawFlags = baseFlags { packageType = Flag pkgType }
71+
rawFlags
72+
| pkgType == Executable = baseFlags
73+
{ packageType = Flag pkgType
74+
, exposedModules = Nothing
75+
}
76+
| otherwise = baseFlags { packageType = Flag pkgType }
7277

7378

7479
-- ==================================================
@@ -109,7 +114,7 @@ baseFlags = defaultInitFlags {
109114
, mainIs = Flag "Main.hs"
110115
, applicationDirs = Just ["app"]
111116
, sourceDirs = Nothing
112-
, exposedModules = Nothing
117+
, exposedModules = Just [ModuleName.fromString "MyLib"]
113118
, initializeTestSuite = Flag False
114119
, testDirs = Nothing
115120
}
@@ -136,6 +141,7 @@ exeFlags = baseFlags {
136141
, mainIs = Flag "Main.hs"
137142
, sourceDirs = Just []
138143
, applicationDirs = Just ["app"]
144+
, exposedModules = Nothing
139145
}
140146

141147

@@ -158,7 +164,6 @@ libAndExeFlags = baseFlags {
158164

159165
-- Library sources live in src/ and expose the module MyLib.
160166
, sourceDirs = Just ["src"]
161-
, exposedModules = Just [ModuleName.fromString "MyLib"]
162167
}
163168

164169

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cabal-version: 2.4
2+
name: foo
3+
version: 3.2.1
4+
synopsis: The foo package
5+
homepage: https://github.com/foo/foo
6+
license: NONE
7+
author: me
8+
maintainer: me@me.me
9+
category: SomeCat
10+
extra-source-files: CHANGELOG.md
11+
12+
executable foo
13+
main-is: Main.hs
14+
build-depends:
15+
base ^>=4.13.0.0,
16+
containers ^>=5.7.0.0,
17+
unordered-containers ^>=2.7.0.0
18+
19+
hs-source-dirs: app
20+
default-language: Haskell2010
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cabal-version: 2.4
2+
name: foo
3+
version: 3.2.1
4+
synopsis: The foo package
5+
homepage: https://github.com/foo/foo
6+
license: NONE
7+
author: me
8+
maintainer: me@me.me
9+
category: SomeCat
10+
extra-source-files: CHANGELOG.md
11+
12+
library
13+
exposed-modules: MyLib
14+
build-depends:
15+
base ^>=4.13.0.0,
16+
containers ^>=5.7.0.0,
17+
unordered-containers ^>=2.7.0.0
18+
19+
hs-source-dirs: src
20+
default-language: Haskell2010
21+
22+
executable foo
23+
main-is: Main.hs
24+
build-depends:
25+
base ^>=4.13.0.0,
26+
containers ^>=5.7.0.0,
27+
unordered-containers ^>=2.7.0.0,
28+
foo
29+
30+
hs-source-dirs: app
31+
default-language: Haskell2010
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
cabal-version: 2.4
2+
name: foo
3+
version: 3.2.1
4+
synopsis: The foo package
5+
homepage: https://github.com/foo/foo
6+
license: NONE
7+
author: me
8+
maintainer: me@me.me
9+
category: SomeCat
10+
extra-source-files: CHANGELOG.md
11+
12+
library
13+
exposed-modules:
14+
A
15+
B
16+
17+
build-depends:
18+
base ^>=4.13.0.0,
19+
containers ^>=5.7.0.0,
20+
unordered-containers ^>=2.7.0.0
21+
22+
hs-source-dirs: src
23+
default-language: Haskell2010
24+
25+
executable foo
26+
main-is: Main.hs
27+
build-depends:
28+
base ^>=4.13.0.0,
29+
containers ^>=5.7.0.0,
30+
unordered-containers ^>=2.7.0.0
31+
32+
hs-source-dirs: app
33+
default-language: Haskell2010
34+
35+
test-suite foo-test
36+
default-language: Haskell2010
37+
type: exitcode-stdio-1.0
38+
hs-source-dirs: tests
39+
main-is: MyLibTest.hs
40+
build-depends:
41+
base ^>=4.13.0.0,
42+
containers ^>=5.7.0.0,
43+
unordered-containers ^>=2.7.0.0
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
cabal-version: 2.4
2+
3+
-- Initial package description 'lib-exe-and-test-with-comments-golden.cabal' generated by
4+
-- 'cabal init'. For further documentation, see:
5+
-- http://haskell.org/cabal/users-guide/
6+
--
7+
-- The name of the package.
8+
name: foo
9+
10+
-- The package version.
11+
-- See the Haskell package versioning policy (PVP) for standards
12+
-- guiding when and how versions should be incremented.
13+
-- https://pvp.haskell.org
14+
-- PVP summary: +-+------- breaking API changes
15+
-- | | +----- non-breaking API additions
16+
-- | | | +--- code changes with no API change
17+
version: 3.2.1
18+
19+
-- A short (one-line) description of the package.
20+
synopsis: The foo package
21+
22+
-- A longer description of the package.
23+
-- description:
24+
25+
-- URL for the project homepage or repository.
26+
homepage: https://github.com/foo/foo
27+
28+
-- A URL where users can report bugs.
29+
-- bug-reports:
30+
31+
-- The license under which the package is released.
32+
license: NONE
33+
34+
-- The package author(s).
35+
author: me
36+
37+
-- An email address to which users can send suggestions, bug reports, and patches.
38+
maintainer: me@me.me
39+
40+
-- A copyright notice.
41+
-- copyright:
42+
category: SomeCat
43+
44+
-- Extra files to be distributed with the package, such as examples or a README.
45+
extra-source-files: CHANGELOG.md
46+
47+
library
48+
-- Modules exported by the library.
49+
exposed-modules:
50+
A
51+
B
52+
53+
-- Modules included in this library but not exported.
54+
-- other-modules:
55+
56+
-- LANGUAGE extensions used by modules in this package.
57+
-- other-extensions:
58+
59+
-- Other library packages from which modules are imported.
60+
build-depends:
61+
base ^>=4.13.0.0,
62+
containers ^>=5.7.0.0,
63+
unordered-containers ^>=2.7.0.0
64+
65+
-- Directories containing source files.
66+
hs-source-dirs: src
67+
68+
-- Base language which the package is written in.
69+
default-language: Haskell2010
70+
71+
executable foo
72+
-- .hs or .lhs file containing the Main module.
73+
main-is: Main.hs
74+
75+
-- Modules included in this executable, other than Main.
76+
-- other-modules:
77+
78+
-- LANGUAGE extensions used by modules in this package.
79+
-- other-extensions:
80+
81+
-- Other library packages from which modules are imported.
82+
build-depends:
83+
base ^>=4.13.0.0,
84+
containers ^>=5.7.0.0,
85+
unordered-containers ^>=2.7.0.0
86+
87+
-- Directories containing source files.
88+
hs-source-dirs: app
89+
90+
-- Base language which the package is written in.
91+
default-language: Haskell2010
92+
93+
test-suite foo-test
94+
-- Base language which the package is written in.
95+
default-language: Haskell2010
96+
97+
-- The interface type and version of the test suite.
98+
type: exitcode-stdio-1.0
99+
100+
-- Directories containing source files.
101+
hs-source-dirs: tests
102+
103+
-- The entrypoint to the test suite.
104+
main-is: MyLibTest.hs
105+
106+
-- Test dependencies.
107+
build-depends:
108+
base ^>=4.13.0.0,
109+
containers ^>=5.7.0.0,
110+
unordered-containers ^>=2.7.0.0

0 commit comments

Comments
 (0)