Skip to content

Commit 959ed3d

Browse files
committed
Checks for depending on GHC
1 parent 40e0d13 commit 959ed3d

File tree

1 file changed

+20
-0
lines changed
  • cabal-install/tests/UnitTests/Distribution/Solver/Modular

1 file changed

+20
-0
lines changed

cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,16 @@ tests = [
153153
solverFailure (isInfixOf "only already installed instances can be used")
154154
, runTest $ allowBootLibInstalls $ mkTest dbBase "Install base with --allow-boot-library-installs" ["base"] $
155155
solverSuccess [("base", 1), ("ghc-prim", 1), ("integer-gmp", 1), ("integer-simple", 1)]
156+
, runTest $ mkTest dbGHCDepend "Refuse to install newer version of ghc requested by another library" ["A"] $
157+
solverFailure . isInfixOf $
158+
"Could not resolve dependencies:\n"
159+
++ "[__0] trying: A-1.0.0 (user goal)\n"
160+
++ "[__1] next goal: ghc (dependency of A)\n"
161+
++ "[__1] rejecting: ghc-1.0.0/installed-1 (conflict: A => ghc==2.0.0)\n"
162+
++ "[__1] rejecting: ghc-2.0.0 (constraint from non-upgradeable package requires installed instance)\n"
163+
++ "[__1] fail (backjumping, conflict set: A, ghc)\n"
164+
++ "After searching the rest of the dependency tree exhaustively, "
165+
++ "these were the goals I've had most trouble fulfilling: A, ghc"
156166
]
157167
, testGroup "reject-unconstrained" [
158168
runTest $ onlyConstrained $ mkTest db12 "missing syb" ["E"] $
@@ -1123,6 +1133,16 @@ dbBase = [
11231133
, Right $ exAv "integer-gmp" 1 []
11241134
]
11251135

1136+
dbGHCDepend :: ExampleDb
1137+
dbGHCDepend =
1138+
let base = exInst "base" 1 "base-1" []
1139+
in [
1140+
Left base
1141+
, Left $ exInst "ghc" 1 "ghc-1" [base]
1142+
, Right $ exAv "ghc" 2 []
1143+
, Right $ exAv "A" 1 [ExFix "ghc" 2]
1144+
]
1145+
11261146
db13 :: ExampleDb
11271147
db13 = [
11281148
Right $ exAv "A" 1 []

0 commit comments

Comments
 (0)