Skip to content

Commit 57fe800

Browse files
committed
Add more reject-unconstrained tests
1 parent bcbbcff commit 57fe800

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

  • cabal-install/tests/UnitTests/Distribution/Solver/Modular

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,32 @@ tests =
243243
solverFailure (isInfixOf "rejecting: base-1 (constraint from non-reinstallable package requires >=4.22)")
244244
]
245245
, testGroup
246+
-- reject-unconstrained-dependencies=all requires all non-goals to be
247+
-- version constrained. Goals don't need constraints and flag constraints
248+
-- are not enough.
246249
"reject-unconstrained"
247250
[ runTest $
248251
onlyConstrained $
249252
mkTest db12 "missing syb" ["E"] $
250253
solverFailure (isInfixOf "not a user-provided goal")
254+
, runTest $
255+
onlyConstrained $
256+
mkTest db12 "all goals, no other dependencies" ["base", "E", "syb"] $
257+
solverSuccess [("E", 1), ("syb", 2)]
251258
, runTest $
252259
onlyConstrained $
253-
mkTest db12 "all goals" ["E", "syb"] $
254-
solverSuccess [("E", 1), ("syb", 2)]
260+
mkTest db12 "non-goal dependencies are unconstrained" ["E", "syb"] $
261+
solverFailure (isInfixOf "not a user-provided goal")
262+
, runTest $
263+
constraints [ExFlagConstraint (ScopeAnyQualifier "base") "flag" True] $
264+
onlyConstrained $
265+
mkTest db12 "non-goal dependencies are only flag-constrained" ["E", "syb"] $
266+
solverFailure (isInfixOf "not a user-provided goal")
267+
, runTest $
268+
constraints [ExVersionConstraint (ScopeAnyQualifier "base") (V.thisVersion (V.mkVersion [4]))] $
269+
onlyConstrained $
270+
mkTest db12 "non-goal dependencies are version-constrained" ["E", "syb"] $
271+
solverSuccess [("E", 1), ("syb", 2)]
255272
, runTest $
256273
onlyConstrained $
257274
mkTest db17 "backtracking" ["A", "B"] $

0 commit comments

Comments
 (0)