Skip to content

Commit f08a447

Browse files
committed
Removing bounds from base in the init golden tests
1 parent 686d354 commit f08a447

22 files changed

+45
-34
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ goldenExeTests v pkgIx pkgDir pkgName = testGroup "exe golden tests"
159159
where
160160
runGoldenExe opts args flags =
161161
case _runPrompt (genExeTarget flags pkgIx) args of
162-
Right (t, _) -> mkStanza [mkExeStanza opts t]
162+
Right (t, _) -> mkStanza [mkExeStanza opts $ t {_exeDependencies = mangleBaseDep t _exeDependencies}]
163163
Left e -> assertFailure $ show e
164164

165165
goldenLibTests
@@ -201,7 +201,7 @@ goldenLibTests v pkgIx pkgDir pkgName = testGroup "lib golden tests"
201201
where
202202
runGoldenLib opts args flags =
203203
case _runPrompt (genLibTarget flags pkgIx) args of
204-
Right (t, _) -> mkStanza [mkLibStanza opts t]
204+
Right (t, _) -> mkStanza [mkLibStanza opts $ t {_libDependencies = mangleBaseDep t _libDependencies}]
205205
Left e -> assertFailure $ show e
206206

207207
goldenTestTests
@@ -247,7 +247,7 @@ goldenTestTests v pkgIx pkgDir pkgName = testGroup "test golden tests"
247247
Left e -> assertFailure $ show e
248248
Right (Nothing, _) -> assertFailure
249249
"goldenTestTests: Tests not enabled."
250-
Right (Just t, _) -> mkStanza [mkTestStanza opts t]
250+
Right (Just t, _) -> mkStanza [mkTestStanza opts $ t {_testDependencies = mangleBaseDep t _testDependencies}]
251251

252252
-- | Full cabal file golden tests
253253
goldenCabalTests
@@ -279,16 +279,16 @@ goldenCabalTests v pkgIx srcDb = testGroup ".cabal file golden tests"
279279

280280
(Right (ProjectSettings opts pkgDesc (Just libTarget) (Just exeTarget) (Just testTarget), _)) -> do
281281
let pkgFields = mkPkgDescription opts pkgDesc
282-
libStanza = mkLibStanza opts libTarget
283-
exeStanza = mkExeStanza opts exeTarget
284-
testStanza = mkTestStanza opts testTarget
282+
libStanza = mkLibStanza opts $ libTarget {_libDependencies = mangleBaseDep libTarget _libDependencies}
283+
exeStanza = mkExeStanza opts $ exeTarget {_exeDependencies = mangleBaseDep exeTarget _exeDependencies}
284+
testStanza = mkTestStanza opts $ testTarget {_testDependencies = mangleBaseDep testTarget _testDependencies}
285285

286286
mkStanza $ pkgFields ++ [libStanza, exeStanza, testStanza]
287287

288288
(Right (ProjectSettings opts pkgDesc (Just libTarget) Nothing (Just testTarget), _)) -> do
289289
let pkgFields = mkPkgDescription opts pkgDesc
290-
libStanza = mkLibStanza opts libTarget
291-
testStanza = mkTestStanza opts testTarget
290+
libStanza = mkLibStanza opts $ libTarget {_libDependencies = mangleBaseDep libTarget _libDependencies}
291+
testStanza = mkTestStanza opts $ testTarget {_testDependencies = mangleBaseDep testTarget _testDependencies}
292292

293293
mkStanza $ pkgFields ++ [libStanza, testStanza]
294294

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module UnitTests.Distribution.Client.Init.Utils
22
( dummyFlags
33
, emptyFlags
44
, mkLicense
5+
, mangleBaseDep
56
, (@?!)
67
, (@!?)
78
) where
@@ -17,6 +18,8 @@ import Distribution.Types.PackageName
1718
import Distribution.Types.Version
1819
import Language.Haskell.Extension
1920
import Test.Tasty.HUnit
21+
import Distribution.Types.Dependency
22+
import Distribution.Types.VersionRange
2023

2124

2225
-- -------------------------------------------------------------------- --
@@ -50,6 +53,14 @@ emptyFlags = mempty
5053
mkLicense :: SPDX.LicenseId -> SPDX.License
5154
mkLicense lid = SPDX.License (SPDX.ELicense (SPDX.ELicenseId lid) Nothing)
5255

56+
mangleBaseDep :: a -> (a -> [Dependency]) -> [Dependency]
57+
mangleBaseDep target f =
58+
[ if unPackageName x == "base"
59+
then Dependency x anyVersion z
60+
else dep
61+
| dep@(Dependency x _ z) <- f target
62+
]
63+
5364
infix 1 @?!, @!?
5465

5566
-- | Just like @'@?='@, except it checks for difference rather than equality.

cabal-install/tests/fixtures/init/golden/cabal/cabal-lib-and-exe-no-comments.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ library
2525

2626
-- LANGUAGE extensions used by modules in this package.
2727
-- other-extensions:
28-
build-depends: base ^>=4.14.1.0
28+
build-depends: base
2929
hs-source-dirs: src
3030
default-language: Haskell98
3131

@@ -38,7 +38,7 @@ executable y
3838
-- LANGUAGE extensions used by modules in this package.
3939
-- other-extensions:
4040
build-depends:
41-
base ^>=4.14.1.0,
41+
base,
4242
y
4343

4444
hs-source-dirs: exe
@@ -56,6 +56,6 @@ test-suite y-test
5656
hs-source-dirs: test
5757
main-is: Main.hs
5858
build-depends:
59-
base ^>=4.14.1.0,
59+
base,
6060
y
6161

cabal-install/tests/fixtures/init/golden/cabal/cabal-lib-and-exe-with-comments.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ library
5656
-- other-extensions:
5757

5858
-- Other library packages from which modules are imported.
59-
build-depends: base ^>=4.14.1.0
59+
build-depends: base
6060

6161
-- Directories containing source files.
6262
hs-source-dirs: src
@@ -76,7 +76,7 @@ executable y
7676

7777
-- Other library packages from which modules are imported.
7878
build-depends:
79-
base ^>=4.14.1.0,
79+
base,
8080
y
8181

8282
-- Directories containing source files.
@@ -106,6 +106,6 @@ test-suite y-test
106106

107107
-- Test dependencies.
108108
build-depends:
109-
base ^>=4.14.1.0,
109+
base,
110110
y
111111

cabal-install/tests/fixtures/init/golden/cabal/cabal-lib-no-comments.golden

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ library
2525

2626
-- LANGUAGE extensions used by modules in this package.
2727
-- other-extensions:
28-
build-depends: base ^>=4.14.1.0
28+
build-depends: base
2929
hs-source-dirs: src
3030
default-language: Haskell98
3131

@@ -41,6 +41,6 @@ test-suite y-test
4141
hs-source-dirs: test
4242
main-is: Main.hs
4343
build-depends:
44-
base ^>=4.14.1.0,
44+
base,
4545
y
4646

cabal-install/tests/fixtures/init/golden/cabal/cabal-lib-with-comments.golden

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ library
5656
-- other-extensions:
5757

5858
-- Other library packages from which modules are imported.
59-
build-depends: base ^>=4.14.1.0
59+
build-depends: base
6060

6161
-- Directories containing source files.
6262
hs-source-dirs: src
@@ -85,6 +85,6 @@ test-suite y-test
8585

8686
-- Test dependencies.
8787
build-depends:
88-
base ^>=4.14.1.0,
88+
base,
8989
y
9090

cabal-install/tests/fixtures/init/golden/exe/exe-build-tools-with-comments.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ executable y
99
-- other-extensions:
1010

1111
-- Other library packages from which modules are imported.
12-
build-depends: base ^>=4.14.1.0
12+
build-depends: base
1313

1414
-- Directories containing source files.
1515
hs-source-dirs: exe
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
executable y
22
main-is: Main.hs
3-
build-depends: base ^>=4.14.1.0
3+
build-depends: base
44
hs-source-dirs: exe
55
default-language: Haskell2010

cabal-install/tests/fixtures/init/golden/exe/exe-simple-with-comments.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ executable y
33
main-is: Main.hs
44

55
-- Other library packages from which modules are imported.
6-
build-depends: base ^>=4.14.1.0
6+
build-depends: base
77

88
-- Directories containing source files.
99
hs-source-dirs: exe

cabal-install/tests/fixtures/init/golden/exe/exe-with-comments.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ executable y
99
-- other-extensions:
1010

1111
-- Other library packages from which modules are imported.
12-
build-depends: base ^>=4.14.1.0
12+
build-depends: base
1313

1414
-- Directories containing source files.
1515
hs-source-dirs: exe

cabal-install/tests/fixtures/init/golden/exe/exe.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ executable y
66

77
-- LANGUAGE extensions used by modules in this package.
88
-- other-extensions:
9-
build-depends: base ^>=4.14.1.0
9+
build-depends: base
1010
hs-source-dirs: exe
1111
default-language: Haskell2010

cabal-install/tests/fixtures/init/golden/lib/lib-build-tools-with-comments.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ library
99
-- other-extensions:
1010

1111
-- Other library packages from which modules are imported.
12-
build-depends: base ^>=4.14.1.0
12+
build-depends: base
1313

1414
-- Directories containing source files.
1515
hs-source-dirs: src
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
library
22
exposed-modules: MyLib
3-
build-depends: base ^>=4.14.1.0
3+
build-depends: base
44
hs-source-dirs: src
55
default-language: Haskell98

cabal-install/tests/fixtures/init/golden/lib/lib-simple-with-comments.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ library
33
exposed-modules: MyLib
44

55
-- Other library packages from which modules are imported.
6-
build-depends: base ^>=4.14.1.0
6+
build-depends: base
77

88
-- Directories containing source files.
99
hs-source-dirs: src

cabal-install/tests/fixtures/init/golden/lib/lib-simple.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ library
66

77
-- LANGUAGE extensions used by modules in this package.
88
-- other-extensions:
9-
build-depends: base ^>=4.14.1.0
9+
build-depends: base
1010
hs-source-dirs: src
1111
default-language: Haskell98

cabal-install/tests/fixtures/init/golden/lib/lib-with-comments.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ library
99
-- other-extensions:
1010

1111
-- Other library packages from which modules are imported.
12-
build-depends: base ^>=4.14.1.0
12+
build-depends: base
1313

1414
-- Directories containing source files.
1515
hs-source-dirs: src

cabal-install/tests/fixtures/init/golden/lib/lib.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ library
66

77
-- LANGUAGE extensions used by modules in this package.
88
-- other-extensions:
9-
build-depends: base ^>=4.14.1.0
9+
build-depends: base
1010
hs-source-dirs: src
1111
default-language: Haskell98

cabal-install/tests/fixtures/init/golden/test/test-build-tools-with-comments.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ test-suite y-test
1818
main-is: Main.hs
1919

2020
-- Test dependencies.
21-
build-depends: base ^>=4.14.1.0
21+
build-depends: base
2222

2323
-- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source.
2424
build-tools: happy

cabal-install/tests/fixtures/init/golden/test/test-minimal-no-comments.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ test-suite y-test
33
type: exitcode-stdio-1.0
44
hs-source-dirs: test
55
main-is: Main.hs
6-
build-depends: base ^>=4.14.1.0
6+
build-depends: base

cabal-install/tests/fixtures/init/golden/test/test-simple-with-comments.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ test-suite y-test
1212
main-is: Main.hs
1313

1414
-- Test dependencies.
15-
build-depends: base ^>=4.14.1.0
15+
build-depends: base

cabal-install/tests/fixtures/init/golden/test/test-with-comments.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ test-suite y-test
1818
main-is: Main.hs
1919

2020
-- Test dependencies.
21-
build-depends: base ^>=4.14.1.0
21+
build-depends: base

cabal-install/tests/fixtures/init/golden/test/test.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ test-suite y-test
99
type: exitcode-stdio-1.0
1010
hs-source-dirs: test
1111
main-is: Main.hs
12-
build-depends: base ^>=4.14.1.0
12+
build-depends: base

0 commit comments

Comments
 (0)